BuildMyWeb Posted May 30, 2014 Share Posted May 30, 2014 firstly, apologies on my TOPIC TITLE. i couldnt think of how better to write it. anywho, i am inserting a new row of data into a table. immediately after inserting it, i want to select the unique value in the 'id' row. two questions. 1. how can i reference this newly inserted row if the only unique value is the id (primary auto-increment)? 2. is there a way to insert this new row AND select that id value in one query? Link to comment https://forums.phpfreaks.com/topic/288880-how-to-select-newly-inserted-row-without-having-unique-id-to-reference/ Share on other sites More sharing options...
mac_gyver Posted May 30, 2014 Share Posted May 30, 2014 both the mysqli and pdo extensions have a last insert id method/function - http://www.php.net/manual/en/mysqli.insert-id.php or http://us1.php.net/manual/en/pdo.lastinsertid.php Link to comment https://forums.phpfreaks.com/topic/288880-how-to-select-newly-inserted-row-without-having-unique-id-to-reference/#findComment-1481397 Share on other sites More sharing options...
BuildMyWeb Posted May 30, 2014 Author Share Posted May 30, 2014 thx mac! ill check that out Link to comment https://forums.phpfreaks.com/topic/288880-how-to-select-newly-inserted-row-without-having-unique-id-to-reference/#findComment-1481399 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.