I'm in the PHP spelling of the SQL statement, after the input is this
SELECT * from ' zx_solutions ' where s_id = 6?
Put this statement in the database to execute, reported the following error:
[SQL]
SELECT * from ' zx_solutions ' where s_id = 6?
[ERR] 1054-unknown column ' 6? ' in ' WHERE clause '
Please expert guidance:
Reply to discussion (solution)
SELECT * from ' zx_solutions ' where ' s_id ' = 6?
Such
@ #2, that doesn't work, it treats 6 as a column
Post your code snippet
Guess where the space was wrong.
function Getsolutionbyid ($SID) {
$sql = "SELECT * from zx_solutions where s_id = $sid";
Echo $sql;
$rs = $this->db->query ($sql);
return $rs;
}
Run the above code error?
What database do you use, what is the structure of the Zx_solutions table? It's best to list them all.
Try the 6 quotation marks.
6 don't have a space at the front
You change a tool to run a test, not yet, it is probably MySQL problem, it can only explain
It's very practical to learn.
Is ' zx_solutions ' sure it is ' this symbol?
SELECT * from ' Table name ' where field name = ' 6 '
It could be the wrong sign.
SELECT * from ' zx_solutions ' where ' s_id ' = ' 6 '?
First check whether the connection database and data table is successful, and then check whether the value of the query is malformed, step by step slowly
????
function Getsolutionbyid ($sid) { $sql = "SELECT * from zx_solutions where s_id =". Intval ($SID); echo $sql; $rs = $this->db->query ($sql);