$sql="INSERT INTO wp_comments (comment_post_ID, comment_author, comment_date, comment_content, user_id)
VALUES
('$qID', '$author', '$dro', '$content', '$_SESSION[user_id]')";
$result = mysql_query($sql);
die(last_insert_id());
When I run this code I see white screen only, so last_insert_id() doesn’t seem to return any value… What am I doing wrong?
mysql_insert_id()may be the function you are looking for to retrieve the id of the last inserted row.http://php.net/manual/en/function.mysql-insert-id.php