简体   繁体   中英

mysqli select query error 1064

trying to make a query:

$word = $mysqli->real_escape_string($words[$value]);
$valor = $mysqli->real_escape_string($value);

$query = $mysqli->query("SELECT 'w_id' FROM '$valor' WHERE word='$word'");

But the result is :

Error (1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''eng' WHERE word='msms'' at line 1

here eng is a value of $valor

I tried allready a lot of possibilities to insert the variable, and changed names of tables, but nothing helps

tried '".$valor."' as well

请勿在表/字段名称两边加上引号:

$query = $mysqli->query("SELECT w_id FROM " . $valor . " WHERE word = '" . $word . "'");

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM