There are two extra methods for SQLite that you are likely to find helpful. Firstly, the equivalent function of mysqli_insert_id() is lastInsertRowID(), and is a method on your open database connection. Remember that creating auto-incrementing fields in SQLite requires you to declare them as "INTEGER PRIMARY KEY" - the AUTO_INCREMENT keyword is not required. lastInsertRowID() will return the auto-increment ID number that was used for the last INSERT query you sent.
Secondly, the querySingle() method lets you execute an SQL query and get back the first column of the first row of the result of your query, which makes it extremely convenient for quick queries. If you set the second parameter to querySingle() to be true, then you get back an array of all the values that represent the first row of the result.
Want to learn PHP 7?
Hacking with PHP has been fully updated for PHP 7, and is now available as a downloadable PDF. Get over 1200 pages of hands-on PHP learning today!
If this was helpful, please take a moment to tell others about Hacking with PHP by tweeting about it!