PHP更新查询不起作用

时间:2018-05-03 06:16:23

标签: php mysql

伙计我在更新数据方面遇到了一些问题,请尽快帮助解决此问题。 我得到了一些错误的回应我不知道为什么? 我收到的更新查询的语法错误主要是列名时间,我很困惑。所以请提供正确的语法

$query= "UPDATE nesbaty_offer SET  'offer_punch' ='$offer_punch',
                                 'offer_description' ='$offer_description',
                                 'terms' ='$terms',
                                 'sales_discount' ='$sales_discount',
                                 'referal' ='$referal',
                                 'duration' ='$duration',
                                 'billing_type' ='$billing_type',
                                 'status' ='$status',
                                 'service_location' ='$service_location',
                                  'time' ='$date'
                                  where 
                                  offer_id = $offer_id";

2 个答案:

答案 0 :(得分:0)

你的query.try中有一个语法错误

$query= "UPDATE nesbaty_offer SET  offer_punch ='$offer_punch',
                                 offer_description ='$offer_description',
                                 terms ='$terms',
                                 sales_discount ='$sales_discount',
                                 referal ='$referal',
                                 duration ='$duration',
                                 billing_type ='$billing_type',
                                 status ='$status',
                                 service_location ='$service_location',
                                  `time` ='$date'
                                  where 
                                  offer_id = '$offer_id'";

答案 1 :(得分:0)

删除列

的qoutes
$query= "UPDATE nesbaty_offer SET  offer_punch ='$offer_punch',
                                 offer_description ='$offer_description',
                                 terms ='$terms',
                                 sales_discount ='$sales_discount',
                                 referal ='$referal',
                                 duration ='$duration',
                                 billing_type ='$billing_type',
                                 status ='$status',
                                 service_location ='$service_location',
                                time ='$date'
                                  where 
                                  offer_id = $offer_id";