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

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

WBOY
Release: 2016-06-13 12:53:41
Original
922 people have browsed it

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]')");
Copy after login
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