注册 登录
编程论坛 MySQL论坛

网页代码错误,求高手指点!

wsj_605 发布于 2015-03-31 22:52, 2308 次点击
<?php
    require_once('Connections/php.php'); //设置数据库连接
    mysql_select_db($database_php, $php); //链接数据库
    $id = $_GET['id']; //接收传递的URL参数
    $updateCommand="UPDATE news SET hits = hits + 1 where id = $id"; //更新数据的SQL字符串
    mysql_query($updateCommand,$php);//执行postmain数据的更新

    $updateGoTo = "news.php?id=".$id;  //设置更新后前往的页面
    header(sprintf("Location: %s", $updateGoTo));  //执行页面的转换
?>


页面预览返回值是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 '' at line 1
请问代码应该怎么改?
1 回复
#2
执笔画江山2015-04-04 20:57
看不懂
1