我有一个非常奇怪的问题,插入值到我的MySQL数据库,使用php,所以我正在运行测试,最简单的插入;以下不工作:数据没有插入到mysql数据库中,因为引用不同
<?php
include("config.php"); // put the *FULL* path to the file.
mysql_query("INSERT INTO 'lms'.'test2' ('trn') VALUES ('17')");
?>
不过了以下工作:(注意单引号的区别)
<?php
include("config.php"); // put the *FULL* path to the file.
mysql_query("INSERT INTO `lms`.`test2` (`trn`) VALUES ('17')");
?>
我实在看不出有什么问题,我能得到和帮助,请
在MySQL中,你不能使用'''包围表和专栏的名字。正确的字符是'\''。另一方面,对于字符串,正确的是'''。 – Adi 2012-08-02 12:11:08
'mysql_'已被弃用。请改用MySQLi或PDO。这是一篇关于该主题的文章,http://anuary.com/54/input-sanitization-and-escaping-for-database-and-stdout-using-php。 – Gajus 2012-08-02 12:30:52