大家看看小弟我这句话那里出错了

WBOY
Release: 2016-06-13 12:54:00
Original
975 people have browsed it

大家看看我这句话那里出错了?
mysql_query("DROP PROCEDURE IF EXISTS change",$con) or die("出错了:".mysql_error());

最近在学习存储过程的事情,用 PHP 添加和删除存储过程。


错误提示为:

出错了: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 'change' at line 1

搞不懂,即使更简单一些,变成 

mysql_query("DROP PROCEDURE IF EXISTS change") or die("出错了:".mysql_error());

也不行。。。。

但是,如果我将后面的一句 or die("出错了:".mysql_error()) 删除掉,程序又不报错。。。

为什么啊


------解决方案--------------------
change 是 mysql 保留字,需转义
mysql_query("DROP PROCEDURE IF EXISTS `change`",$con) or die("出错了:".mysql_error());
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!