关于mysql_insert_id的问题
$lastid=mysql_insert_id();
$query="insert into 'mywesite'.'word'('id','word') values('".$lastid."','".$word."')";
这样是不是不对?
一直这样说:
Warning: mysql_insert_id() [function.mysql-insert-id]: A link to the server could not be established in F:\xampp\htdocs\my website\add_url.php on line 50
------解决方案--------------------
PHP code
<?php
mysql_connect("localhost", "mysql_user", "mysql_password") or
die("Could not connect: " . mysql_error());
mysql_select_db("mydb");
mysql_query("INSERT INTO mytable (product) values ('kossu')");
printf ("Last inserted record has id %d\n", mysql_insert_id());
?>