In php, I spell the SQL statement in php. after the input, select & nbsp; * & nbsp; from & nbsp; 'zx _ solution' & nbsp; where & nbsp; s_id & nbsp ;=& nbsp; 6? Run this statement in the database and report the following error: [SQL statement spelled in php
I entered the spelling 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:
------ Solution --------------------
Select * from 'zx _ solutions 'where's _ id' = 6?
This way
------ Solution --------------------
Paste your code snippet
It is estimated that the space is incorrect.
------ Solution --------------------
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.
------ Solution --------------------
Try to enclose 6 with quotation marks?
------ Solution --------------------
6. do not have spaces on the front.
------ Solution --------------------
If you try another tool, it may be a problem with mysql.
------ Solution --------------------
Practical
------ Solution --------------------
Are you sure you want to use the 'zx _ solution' symbol?
------ Solution --------------------
Select * from 'table name' where field name = '6'
It may be a wrong symbol.
------ Solution --------------------
Select * from 'zx _ solutions 'Where's _ id' = '6'
------ Solution --------------------
Check whether the database and data table are connected successfully, and then check whether the queried value is incorrectly formatted.
------ Solution --------------------
Please refer to this
function getsolutionbyid($sid) {
$sql = "select * from zx_solutions where s_id =".intval($sid);
echo $sql;
$rs = $this->db->query($sql);
return $rs;
}