where in()
where in()
gledson_eduardo
Posts: 3Questions: 0Answers: 0
Hi,
I used
->where('category', '1') ---------> WHERE category = '1'
and work fine, but I need also like
????? --------------> WHERE category IN ('1', '2','3')
it's possibile??
tks a lot
I used
->where('category', '1') ---------> WHERE category = '1'
and work fine, but I need also like
????? --------------> WHERE category IN ('1', '2','3')
it's possibile??
tks a lot
This discussion has been closed.
Replies
This is presumably just for the loading for the data (not the editing)? You could use the `sql()` method ( http://editor.datatables.net/docs/current/php/class-DataTables.Database.html#_sql ) to query the database directly if you want. Just check for `! isset( $_REQUEST['action'] )` to know when DataTables is requesting data.
Allan
Tks for you replay,
Yes, i'm not editing, only loading data.
I study sql() but I'm not understand
Gledson
[code]
$data = $db->sql('SELECT ... FROM ... WHERE ...')->fetchAll();
[/code]
Then you have the data from the query and you can `json_encode` it to send to the client.
Allan
When using (SQL) JSON format is not the same as before.
sql format () is as follows:
[{"id":"1","0":"1","pst_grad":"0....
and the original form:
{"id":-1,"error":"","fieldErrors":[],"data":[],"aaData":[{"DT_RowId":"row_1","id":"1","pst_grad":"0".....
And not appear in the data grid,
Tip?
Allan