The SQL statement I spelled in php is an SQL statement in php.
Select * from 'zx _ solutions 'where s_id = 6?
Run this statement in the database and report the following error:
[SQL]
Select * from 'zx _ solutions 'where s_id = 6?
[Err] 1054-Unknown column '6? 'In' where clause'
Expert advice:
Reply to discussion (solution)
Select * from 'zx _ solutions 'where's _ id' = 6?
This way
@ #2. this won't work either. it regards 6 as a column.
Paste your code snippet
It is estimated that the space is incorrect.
Function getsolutionbyid ($ sid ){
$ SQL = "select * from zx_solutions where s_id = $ sid ";
Echo $ SQL;
$ Rs = $ this-> db-> query ($ SQL );
Return $ rs;
}
When I run the above code, an error is reported?
What database are you using, and what is the structure of the zx_solutions table. It is best to list all of them.
Try to enclose 6 with quotation marks?
6. do not have spaces on the front.
If you try another tool, it may be a problem with mysql.
Practical
Are you sure you want to use the 'zx _ solution' symbol?
Select * from 'table name' where field name = '6'
It may be a wrong symbol.
Select * from 'zx _ solutions 'Where's _ id' = '6 '?
Check whether the database and data table are connected successfully, and then check whether the queried value is incorrectly formatted.
????
function getsolutionbyid($sid) { $sql = "select * from zx_solutions where s_id =".intval($sid); echo $sql; $rs = $this->db->query($sql); return $rs;}