Home  >  Article  >  Backend Development  >  mysql“ insert 表名…”表名是不是可以使变量

mysql“ insert 表名…”表名是不是可以使变量

WBOY
WBOYOriginal
2016-06-13 11:14:591153browse

mysql“ insert 表名……”表名是否可以使变量?
mysql“ insert 表名……”表名是否可以使变量?怎样实现?


------解决方案--------------------
mysql_query("insert into ".$tableName."  (id,name,telephone) values ('$counters[0]','$counters[1]','$counters[2]')");
------解决方案--------------------
打印你的sql,看输出什么东西
------解决方案--------------------
表名不用加单引号 直接输出sql语句看下就知道错在那了
------解决方案--------------------
mysql_query("insert into `$tableName` (id,name,telephone) values ('$counters[0]','$counters[1]','$counters[2]')");
Statement:
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