我收到下一段中显示的错误消息。下面粘贴的代码以前工作但是现在它给出了一个错误,甚至同一个文件也适用于其他页面等... 请帮帮我...
您的SQL语法有错误;检查手册 对应于您的MySQL服务器版本,以便使用正确的语法 靠近''第1行:
<?php
// Connects to your Database
mysql_connect('localhost', 'root', '') or die(mysql_error());
mysql_select_db('test') or die(mysql_error());
//Adds to the click count for a particular link
mysql_query("UPDATE items SET downloads = downloads + 1 WHERE id = $item_id")or die(mysql_error());
//Retrieves information
$data = mysql_query("SELECT * FROM items WHERE id = $item_id") or die(mysql_error());
$info = mysql_fetch_array($data);
header( "Location:" .$info['path'] );
?>
答案 0 :(得分:0)
WHERE id =“。$ item_id。”
<?php
// Connects to your Database
mysql_connect('localhost', 'root', '') or die(mysql_error());
mysql_select_db('test') or die(mysql_error());
//Adds to the click count for a particular link
mysql_query("UPDATE items SET downloads = downloads + 1 WHERE id = ".$item_id."")or die(mysql_error());
//Retrieves information
$data = mysql_query("SELECT * FROM items WHERE id = ".$item_id."") or die(mysql_error());
$info = mysql_fetch_array($data);
header( "Location:" .$info['path'] );
?>