Reputation: 11782
I am using following code
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 ;
I am getting this error
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
The $name is 'A E Jewelers'
Upvotes: 1
Views: 40
Reputation: 6218
$query = "SELECT * FROM callDetails WHERE storeName = '" . $name ."'";
Upvotes: 2