Alright I have been looking for this for a while now, and didn't really found an answer to my problem.
At the moment I got this syntax:
$sql = sprintf("INSERT INTO users (***, ***, ***, ***) VALUES ('%s', '%s', '%s', %d)", mysql_real_escape_string($***), mysql_real_escape_string($***), mysql_real_escape_string($***), $***);
if(!mysql_query($sql)) { die('error: '.mysql_error()); }
return mysql_insert_id();
And this works fine, and when I want to get an item back from the last inserted row I could do another query with the id I get back.
But my question is, is it possible to give back the whole row at once? So that I don't have to run another query to get an item from the last inserted row.
No, nothing like that is implemented.
I think it's right, because the insert syntax is more complex (see for example on duplicate key
, insert ignore
), and in some case the expected return could be ambiguous
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.