Search code examples
mysqlezsql

ezSQL insert and return id or row?


I most recently came across ezSQL and thought it's pretty cool.

Based on the tutorial, I perform the following to create a new row:

$db->query(“INSERT INTO users (name) VALUES ('Amy')”) ;

How do i retrieve the id ( assuming auto-increment ) for the above query ?

THanks!


Solution

  • According to the documentation, the ID should be accessible with $db->insert_id