ADD附近的SQL语法错误 [英] SQL Syntax Error near ADD

查看:121
本文介绍了ADD附近的SQL语法错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经盯着这个东西已经有一段时间了,我似乎无法弄清楚什么是语法错误.上一次我一直处在这种情况下,这是如此简单,后来我感到很愚蠢.但是,这是另一种尝试:

I've been staring at this thing for a while now and I can't seem to figure out what the syntax error is. I've been in this situation before and last time it was something so unbelievably simple I felt stupid afterwards. But here's to another attempt:

//update database
$q = "
 UPDATE 
  users 
 SET 
  id='$edit_id',
  name='$edit_name',
  bdm='$edit_bdm',
  add='$edit_add',
  pc='$edit_pc',
  location='$edit_outletL',
  style='$edit_outletS',
  coName='$edit_coName',
  coNum='$edit_coTel',
  coEmail='$edit_coEmail',
  password='$edit_pass'
 WHERE
  id='$query_title'
";
$edit_query = mysql_query($q) or die("Database Query Error: ". 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 'add='Llancadle, Nr Barry', pc='CF62 3AQ', location='rural', style='food', coName' at line 1

推荐答案

您需要添加反引号,因为它是一个关键字:

You neeed to backquote add since it is a keyword:

`add` = ...

这篇关于ADD附近的SQL语法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆