我正在使用以下代码
public static function getRecord($query){ // Gets single record and returns single associative array
db::open();
$result = mysql_query($query) or die(mysql_error());
if(!mysql_num_rows($result)==0){
$recordset = mysql_fetch_assoc($result);
}else{
$recordset = false;
}
db::close();
return ($recordset);
}
$query = "SELECT * FROM callDetails WHERE storeName = " . $name ;
我收到此错误
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 'E Jewelers LIMIT 0, 50' at line 1
$ name是'A E Jewelers'
答案 0 :(得分:2)
$query = "SELECT * FROM callDetails WHERE storeName = '" . $name ."'";