HREF: ' __url__/sblog/id/' +idd,
$json a null output template. Output list data to the front end for 1 o'clock, formatted as Jsonpublic function Sblog ($json =null, $id =null) {if (!is_int ((int) $json)) {$json = NULL;} Dump ($id); Here can display ID 16if ($json ==1) {$sblog = M (' sbly_table '),//$id = Intval ($id),//$info = $sblog->order (' id desc ')->where (' Lj_sbid= '. $id)->select () $info = $sblog->order (' id desc ')->select (); $new _info = Array (); foreach ($info as $t) {if ($t [' Lj_ly_zt ']==1) {$t [' lj_ly_zt '] = ' open ';} else{$t [' lj_ly_zt '] = ' off ';} $new _info[] = $t;} Echo Json_encode ($new _info); unset ($sblog, $info, $new _info);} else{$this->display ();} Unset ($Public); }
$json = 1 o'clock, the output of the following 3 items:
[{"id": "$", "user_id": "1", "title": "001", "Lj_sbid": "},{", "user_id": "1", "title": "002", "Lj_sbid": "18"} ,
{"id": "" "," user_id ":" 1 "," title ":" 003 "," Lj_sbid ":" 17 "}]
The 3 rows of data are displayed correctly after the front-end processing, but I just want to show the data of Lj_sbid 16.
$info = $sblog->order (' id desc ')->where (' lj_sbid=16 ')->select ();
This will correctly display a data lj_sbid of 16, but this is:
$info = $sblog->order (' id desc ')->where (' lj_sbid= '. $id)->select ();
and can't output? What's the right way to write? Thank you all first.
Reply to discussion (solution)
In theory, there's nothing wrong with that, you can try to output the value of $id.
Order should be behind the where
$id can output 16, exactly where is the error?
What you want is not the value of $id.
Problem with template SQL statement syntax
What you want is not the value of $id.
Problem with template SQL statement syntax
$id just the condition, where is the grammatical error? Please expert guidance, thank you Lord!
Dump ($id); Post the results
Dump ($id);
Output:
String (2) "16"
You're not using Easyui?
Where did the string (2) "16" look?
Tinkphp+easyui
Sblog.htm the template output
Using the volist tag old display loading ..., use the foreach tag to be OK