调用mysql_insert_id会发出警告

Hi I'm receiving this warning when trying to retrieve the insert id

Warning: mysql_insert_id(): supplied argument is not a valid MySQL-Link resource

in

mysql_query($importword); 
$word_id = mysql_insert_id($importword);

if you get the id and that id you want to insert just write mysql_insert_id(); after your query.

You're supposed to pass the connection, or leave it empty to use the last one opened.

mysql_insert_id take the resource identifier not the query

either pass resource or leave blank

$word_id = mysql_insert_id();

$importword is the query that you are executing using msql_query.

Next you are passing the query to mysql_insert_id which is incorrect. mysql_insert_id takes the link identifier which is optional.

If you are not having multiple connections open, just don't pass anything:

mysql_query($importword); 
// do some error checking.

$word_id = mysql_insert_id();

so that it uses the last link opened by mysql_connect