php - How to get last created ID -


no matter try - cant seem pull last created id of query inserted mysql.

i read here syntaxes deprecated , sort of code wont work.

i tried both functions (i use bigint) understand how go:

if (($result = $conn->query("select last_insert_id()")) === false) {   die(mysql_error());  }  if ($result->fetch_assoc()) {  $id = $row[0]; echo $id; } 

but nothing!!

can please give me full simple php code sample of how it?

you can use $result = $conn->insert_id; know last inserted row


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -