Javascript 动态数据库连接
我是网络开发新手。我目前正在学习许多web编程语言(客户端和服务器端) 我正在尝试构建一个web应用程序,根据用户输入连接到许多不同的数据库和这些数据库中的许多不同表 目前我正在使用以下工具: 1.html(用于用户视图) 2.php(用于控制器函数) 3.mysql(我的数据源) 4.appml(便于数据提取和显示) 5.json(用于建模我的数据) 我已经能够创建一个php/html页面,通过appML连接到我的MySQL数据库和其中的一个表 这是我的调用页面code Reports.php:Javascript 动态数据库连接,javascript,php,model-view-controller,web-applications,Javascript,Php,Model View Controller,Web Applications,我是网络开发新手。我目前正在学习许多web编程语言(客户端和服务器端) 我正在尝试构建一个web应用程序,根据用户输入连接到许多不同的数据库和这些数据库中的许多不同表 目前我正在使用以下工具: 1.html(用于用户视图) 2.php(用于控制器函数) 3.mysql(我的数据源) 4.appml(便于数据提取和显示) 5.json(用于建模我的数据) 我已经能够创建一个php/html页面,通过appML连接到我的MySQL数据库和其中的一个表 这是我的调用页面code Reports.php
<?php
?>
<!DOCTYPE html>
<html lang="en">
<title>Customers</title>
<script src="appml.js"></script>
<body>
<div class="container" appml-data="appml.php?model=model_Report.js">
<h1>Interfaces</h1>
<table class="table table-striped table-bordered">
<tr>
<th>Description</th>
<th>Location</th>
<th>Model</th>
<th>Serial Number</th>
<th>IP Address</th>
<th>Subnet/Gateway</th>
<th>Firmware Version</th>
</tr>
<tr appml-repeat="records">
<th>{{description}}</th>
<th>{{location}}</th>
<th>{{model}}</th>
<th>{{serial_number}}</th>
<th>{{ip_address}}</th>
<th>{{subnet_gateway}}</th>
<th>{{firmware_version}}</th>
</tr>
</table>
</div>
</body>
</html>
以下是服务器上运行的appml.php的appml_config.php代码:
<?php echo("Access Forbidden");exit();
?>
{
"dateformat" : "yyyy-mm-dd",
"databases" : [
{
"connection" : "myDB1",
"host" : "localhost",
"dbname" : "**aDataBase**",
"username" : "random",
"password" : "pass"
}
]
}
{
“日期格式”:“yyyy-mm-dd”,
“数据库”:[
{
“连接”:“myDB1”,
“主机”:“本地主机”,
“数据库名”:“**aDataBase**”,
“用户名”:“随机”,
“密码”:“通过”
}
]
}
现在,我想进入下一步,允许用户选择:
1.要连接到哪个数据库
2.要连接到哪个表
3.要运行哪些查询
我用粗体创建的文本是我已确定的动态项。用户应该选择
我尝试过搜索web,使用echo命令将它们替换为相关的PHP变量。但是没有用
谁能给我一个或两个如何实现这一点的指针。
我并不是希望有人为我编写代码,只是想告诉我,在我这方面进行更多的研究和编写代码之后,我正在研究哪些策略和语言能够提供解决方案
谢谢。粗体文本可由单词前后的**标识。粗体文本可由单词前后的**标识。
<?php echo("Access Forbidden");exit();
?>
{
"dateformat" : "yyyy-mm-dd",
"databases" : [
{
"connection" : "myDB1",
"host" : "localhost",
"dbname" : "**aDataBase**",
"username" : "random",
"password" : "pass"
}
]
}