开发者

Call to mysql_insert_id gives warning

Hi I'm receiving this warning when trying to retrieve the insert开发者_StackOverflow 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.


$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


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();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜