エラーが発生しますUnknown column 'first.' in 'field list'
。「try」という名前のデータベース、「first」という名前のテーブル、フィールド「id(int)」および「name(char)」があります。グリッドにデータを表示するために使用している単なるサンプルテーブルですが、このエラーが発生しています。これらのデフォルトの html ファイルと ajax ファイルを次のように編集しました。
インデックス.php
<!DOCTYPE html>
<link rel="stylesheet" href="bootstrap/css/bootstrap.css"/>
<link rel="stylesheet" href="grid.css" title="openJsGrid"/>
<!--<link rel="stylesheet" href="jquery-ui/css/smoothness/jquery-ui- 1.8.22.custom.css"/>-->
<script src="jquery.js" type="text/javascript"></script>
<!--<script src="jquery-ui/js/jquery-ui-1.8.22.custom.min.js" type="text/javascript"> </script>-->
<script src="root.js"></script>
<script src="grid.js"></script>
<script >
$(function() {
$(".users").grid();
});
</script>
</head>
<body>
<h2>Users</h2>
<table class="grid users" action="ajax.php">
<tr>
<th col="id" type="text">ID</th>
<th col="name" type="text">Name</th>
</tr>
</table>
</body>
Ajax.php
<?php
// connect to db
mysql_connect("localhost","root","");
mysql_select_db("try");
// require our class
require_once("grid.php");
$grid = new Grid("first", array(
"save"=>true,
"delete"=>true
));
?>