douyiyang6317 2013-08-15 03:56
浏览 104
已采纳

SQL语法错误[关闭]

I have the following code.

<?php
include ('include/DB_Functions.php');

if(isset($_POST['submit']))
{   $id =$_REQUEST['roomid'];
    $title = $_POST['title'];
    $uid = $_POST['clientId'];
    $location = $_POST['location'];
    $quantity = $_POST['number'];
    $price = $_POST['price'];
    $size = $_POST['size'];
    $description = $_POST['description'];
    $categoryID = 1;
    $sellerAddress = $_POST['selleradd'];
    $sellerPhone = $_POST['sellerphn'];

    mysql_query("UPDATE room_tb SET location ='$location', quantity ='$quantity',price ='$price',area ='$size' description = '$description' postTitle = '$title' WHERE roomID = '$id'")
                or die(mysql_error()); 

    echo "Saved!";  

header('Location:table.php'); 
}

I get an 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 'description = '' postTitle = '' WHERE roomID = '983'' at line 1 What have i done wrong. The DB_Functions.php contains all database connectivity.

  • 写回答

6条回答 默认 最新

  • duandou8457 2013-08-15 03:58
    关注

    Well of course, look at your sql query... it's missing commas.

    UPDATE room_tb SET location ='$location', quantity ='$quantity',price ='$price',area ='$size' description = '$description' postTitle = '$title' WHERE roomID = '$id'"
    

    Should be:

    UPDATE room_tb SET location ='$location', quantity ='$quantity', price ='$price', 
    area ='$size', description = '$description', postTitle = '$title' WHERE roomID = '$id'"
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(5条)

报告相同问题?

悬赏问题

  • ¥15 PADS Logic 原理图
  • ¥15 PADS Logic 图标
  • ¥15 电脑和power bi环境都是英文如何将日期层次结构转换成英文
  • ¥20 气象站点数据求取中~
  • ¥15 如何获取APP内弹出的网址链接
  • ¥15 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了
  • ¥50 STM32单片机传感器读取错误
  • ¥15 (关键词-阻抗匹配,HFSS,RFID标签天线)
  • ¥15 机器人轨迹规划相关问题
  • ¥15 word样式右侧翻页键消失