Javascript datatables{“error”:“发生SQL错误:SQLSTATE[42S22]:未找到列:字段列表中的1054个未知列';用户名'&”
尝试使用jQuery、datatable和php从ajax调用接收数据。 我收到一条错误消息: {“error”:“发生SQL错误:SQLSTATE[42S22]:未找到列:1054“字段列表”中的未知列“username”} 当收到回复时 这是我的html和jquery代码: 请有人帮帮我,我是昨天的存货 这是我的桌子结构 “用户名”列不在表中31秒前的迪帕克Javascript datatables{“error”:“发生SQL错误:SQLSTATE[42S22]:未找到列:字段列表中的1054个未知列';用户名'&”,javascript,php,jquery,datatables,jquery-datatables,Javascript,Php,Jquery,Datatables,Jquery Datatables,尝试使用jQuery、datatable和php从ajax调用接收数据。 我收到一条错误消息: {“error”:“发生SQL错误:SQLSTATE[42S22]:未找到列:1054“字段列表”中的未知列“username”} 当收到回复时 这是我的html和jquery代码: 请有人帮帮我,我是昨天的存货 这是我的桌子结构 “用户名”列不在表中31秒前的迪帕克 我的表中有一个username列检查$sql\u details的db name 数据库名称是supercms 可能您的图片的数据库
我的表中有一个username列检查$sql\u details的db name 数据库名称是supercms
可能您的图片的数据库名称正确。您的表(数据库表)结构是什么??“用户名”列不在表中。我做错了什么?
<table id="example" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>id</th>
<th>username</th>
<th>password</th>
<th>Position</th>
<th>mail</th>
</tr>
</thead>
<tfoot>
<tr>
<th>id</th>
<th>username</th>
<th>password</th>
<th>Position</th>
<th>mail</th>
</tr>
</tfoot> </table>
$('#example').dataTable( {
"processing": true,
"serverSide": true,
"ajax": {
"url": "server.php",
"dataType": "jsonp"
}
} );
// DB table to use
$table = 'users';
// Table's primary key
$primaryKey = 'id';
// Array of database columns which should be read and sent back to DataTables.
// The `db` parameter represents the column name in the database, while the `dt`
// parameter represents the DataTables column identifier. In this case simple
// indexes
$columns = array(
array( 'db' => 'username', 'dt' => 0 ),
array( 'db' => 'password', 'dt' => 1 ),
array( 'db' => 'mail', 'dt' => 2 ),
);
$sql_details = array(
'user' => 'root',
'pass' => '',
'db' => 'autocomplete',
'host' => 'localhost'
);
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* If you just want to use the basic configuration for DataTables with PHP
* server-side, there is no need to edit below this line.
*/
require( 'ssp.class.php' );
echo $_GET['callback'].'('.json_encode(
SSP::simple( $_GET, $sql_details, $table, $primaryKey, $columns )
).');';