Php 如何在jqgrid上绑定mssql表
我想制作一个jqgrid,我想从mssql数据库中放入两个表。 我做了一个.php,但没用,有人能看一下为什么没用吗? 在这件事上我很抱歉 代码> jqgrid代码>Php 如何在jqgrid上绑定mssql表,php,mysql,sql,sql-server,jqgrid,Php,Mysql,Sql,Sql Server,Jqgrid,我想制作一个jqgrid,我想从mssql数据库中放入两个表。 我做了一个.php,但没用,有人能看一下为什么没用吗? 在这件事上我很抱歉 代码> jqgrid代码> <html> <head> <title id='Description'>Expedio Weekly Tickets</title> <script src="js/jquery-1.11.0.min.js" type="text/javascript"&g
<html>
<head>
<title id='Description'>Expedio Weekly Tickets</title>
<script src="js/jquery-1.11.0.min.js" type="text/javascript"></script>
<script src="js/i18n/grid.locale-en.js" type="text/javascript"></script>
<script src="js/jquery.jqGrid.min.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" media="screen"
href="Style/redmond/jquery-ui.min.css"/>
<script type="text/javascript">
$(document).ready(function (){
$("#grid").jqGrid({
data: mydata,
datatype: 'local',
width: 1320,
colNames: ["A", "B", "C"],
colModel:
[
{name: 'A', index: 'A', key: true, width:10},
{name: 'B', index: 'B', width:20},
{name: 'C', index: 'C', width:40}
],
pager: '#pager',
sortname: 'id',
viewrecords: true,
sortorder: "asc",
caption: "Test"
});
});
</script>
</head>
<body>
<table id="grid"></table>
<div id="pager"></div>
</body>
</html>
我得到这个错误>>
致命错误:在第8行的C:\xampp\htdocs\connect.php中调用未定义的函数mssql\u connect
您运行的是MySQL服务器还是Microsoft sql server?否则,mssql_u[command]应该是mysql_[command]。
您的查询字符串get在声明字符串后的行中被覆盖。它应当:
$query=选择列名称;
$query.=来自表_test1;
这将使$query等于从表\u测试中选择列\u名称。
您的数据库中是否存在表_test1?登录的使用凭据是否正确?
while循环不循环任何内容,请参见:例如。
php代码不会将JQGrid从数据库加载数据所必需的任何内容输出为JSON。
jqgrid仅显示示例数据。
我建议在深入编写代码之前,尝试阅读更多关于php和javascript的内容
祝你好运。该错误可能是由于缺少用于与MSSQL通信的PHP扩展而导致的。请阅读如何在php手册中安装mssql扩展:
-特别是“要求和安装”部分您确定已打开mssql的扩展吗?
<html>
<head>
<title id='Description'>Expedio Weekly Tickets</title>
<script src="js/jquery-1.11.0.min.js" type="text/javascript"></script>
<script src="js/i18n/grid.locale-en.js" type="text/javascript"></script>
<script src="js/jquery.jqGrid.min.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" media="screen"
href="Style/redmond/jquery-ui.min.css"/>
<script type="text/javascript">
$(document).ready(function (){
$("#grid").jqGrid({
data: mydata,
datatype: 'local',
width: 1320,
colNames: ["A", "B", "C"],
colModel:
[
{name: 'A', index: 'A', key: true, width:10},
{name: 'B', index: 'B', width:20},
{name: 'C', index: 'C', width:40}
],
pager: '#pager',
sortname: 'id',
viewrecords: true,
sortorder: "asc",
caption: "Test"
});
});
</script>
</head>
<body>
<table id="grid"></table>
<div id="pager"></div>
</body>
</html>
Usee the Adodb class to connect to sqlserver 2008:
The find here:
http://adodb.sourceforge.net/
Example Usage:
include ('adodb / adodb.inc.php ");
$ Conn = & ADONewConnection (odbc_mssql);
/ * Create a connection object to SQL Server * /
$ Data = "Driver = {SQL Server}; Server = 192.168.1.28; Database = master;"
/ * We define our DSN * /
$ Connection-> Connect ($ data, 'db_user', 'pass_dbuser');
/ * Make the connection to the corresponding parameters * /
$ Sql = "SELECT count (*) as count FROM TABLEBD";
/ * SQL Reference is made to know how many records are displayed * /
$ Result = & $ conn-> Execute ($ sql);
if (! $ result)
print $ conn-> ErrorMsg ();
// Declare an if in case your query has not been executed well, to show us the error
else {
if ($ result-> EOF) {$ count = $ result-> fields [0];}
// Echo "The number of records is:" $ count;.
}
/ * We close objects, this step is optional, but optimized our code * /
$ Result-> Close ();
$ Connection-> Close ();
Good Look
fastdid