I have following query:
$query="SELECT language_value, votes, user_id FROM labels WHERE approved=1 AND label_value=".
$data[$i]['label_value']." AND language=".$language_id;
I have got the error:
Error Number: 1054
Unknown column 'AccountPagesView.a_book' in 'where clause'
But 'AccountPagesView.a_book' is value of $data[$i]['label_value'] and isn't a column. Where have I made a mistake?
You should enclose any string values in MySQL in '
:
$query= "SELECT language_value, votes, user_id FROM labels WHERE approved=1 AND label_value='".
$data[$i]['label_value']."' AND language='".$language_id."'";
(I just took a guess, which are string-like columns.)
EDIT
As pointed out by @vstm: make sure the the values, you insert here, are properly escaped.
尝试这个
$query="SELECT language_value, votes, user_id FROM labels WHERE approved=1 AND label_value='".$data[$i]['label_value']."' AND language='".$language_id."'";
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.