mysql>create database test_database;
use test_database;
create things(i_id int,i_name varchar(40),i_price int);
insert into things(i_id,i_name,i_price)values(1,'book',30);
select * from things;
这里一切正常.
偶的php:
$i_id=2;
$i_name="book";
$i_price=30;
$sqllink=mysql_connect("localhost", "_root", "") or die("could not connect.");
mysql_select_db("test_database");
$result=mysql_query("insert into things(i_id,i_name,i_price)values(\'$i_id\',\'$i_name\',\'$i_price\')");
if(!$result)
{
echo "lost.",mysql_error();
exit;
}
到这里php可以正常连接mysql但insert不了,为什么?在网上找不到结果啊
痛苦ing... 它的报错:lost.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 '\'2\',\'book\',\'30\')' at line 1
大家能指点一下小的吗?








为什么我用php无法增加mysql数据










平板模式