【发布时间】:2014-12-15 14:00:28
【问题描述】:
我将以下内容与数据表一起使用,并且可以正常检索我需要的内容:
$table = 'full_data';
$primaryKey = 'index';
$columns = array(
array( 'db' => 'category', 'dt' => 0 ),
array( 'db' => 'value', 'dt' => 1 ),
array( 'db' => 'database_percent', 'dt' => 2),
array( 'db' => 'national_percent', 'dt' => 3 ),
array( 'db' => 'index_value', 'dt' => 4 ),
array( 'db' => 'quadrant', 'dt' => 5 )
);
$sql_details = array(
'user' => 'root',
'pass' => '*****',
'db' => 'my_db',
'host' => 'localhost'
);
require( 'ssp.class.php' );
echo json_encode(
SSP::simple( $_GET, $sql_details, $table, $primaryKey, $columns )
);
我现在想做的是从该文件最终呈现为 JSON 的内容中排除行。得到我想要的 mySQL 查询是这样的:
SELECT * FROM `full_data` WHERE `category` NOT LIKE 'state'
但是,我不知道如何将其包含在我的 php 文件中,以便仅对正确的行进行 JSON 编码以在我的表中使用。对使用 mySQL 数据库/PHP 完全陌生。
编辑:这是我的ssp.class.php 文件。
【问题讨论】:
-
如果没有看到你的 SSP 类实际做了什么,就不可能知道需要什么......
-
@HartmutHolzgraefe 这是我的 SSP 课程的来源:github.com/DataTables/DataTables/blob/master/examples/…
-
您的查询 = 'state' 是因为您没有在 like 语句中添加任何“%”吗?
-
你的数据库表是什么样子的?因为我看到你有一个索引的主键,但是你的列是 index_value?
标签: php mysql json datatables