大家看看我这句话那里出错了?
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());