我無法弄清楚我的SQL有什麼問題。下面是生成查詢的PHP腳本:使用PHP在MySQL中更新blob
function SaveData($data,$id,$file)
{
$handle = fopen($file['file']['tmp_name'], 'r');
$datafile = fread($handle, filesize($file['file']['tmp_name']));
$datafile = mysql_real_escape_string($datafile);
fclose($handle);
$query= "UPDATE data SET Text='" . $data['Text'] . "', Binary='$datafile', Tag='" . $data['Tag'] . "', name='" . $file['file']['name'] . "',type='" . $file['file']['type'] . "', size='" . $file['file']['size'] . "' WHERE Object_ID=".$id;
mysql_query($query,$this->connection) or die(mysql_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 'Binary='%PDF-1.5\r%âãÏÓ\r\n37 0 obj\r<
誰能給我一些指點?