Minase Posted November 24, 2008 Share Posted November 24, 2008 hy there i have some querys entering data into a table and one column is autogenerated by sql server.it is an integrer with auto increment. table overview -ID -Name -Data my query insert information in Name and Data the ID is autogenerated,but after i enter Name and Data i need to get the ID of what was inserted. any typs? thanks Link to comment https://forums.phpfreaks.com/topic/133985-solved-q-php-and-mysql/ Share on other sites More sharing options...
monkeypaw201 Posted November 24, 2008 Share Posted November 24, 2008 well, you could always go back and re-query for the latest entry that matches the name & data you just entered $result= mysql_query("SELECT * FROM `table` WHERE `Name` = '$NameData' AND `Data` = '$DataData' ORDER BY `id` DESC") or die(mysql_error()); $row_result= mysql_fetch_array($result); echo $row_result['id']; Link to comment https://forums.phpfreaks.com/topic/133985-solved-q-php-and-mysql/#findComment-697436 Share on other sites More sharing options...
Minase Posted November 24, 2008 Author Share Posted November 24, 2008 so thats the only solution ? i was thinking on that but i wanted another solve. thanks for reply any other solve this have? Link to comment https://forums.phpfreaks.com/topic/133985-solved-q-php-and-mysql/#findComment-697438 Share on other sites More sharing options...
PFMaBiSmAd Posted November 24, 2008 Share Posted November 24, 2008 http://us3.php.net/mysql_insert_id Link to comment https://forums.phpfreaks.com/topic/133985-solved-q-php-and-mysql/#findComment-697488 Share on other sites More sharing options...
Minase Posted November 24, 2008 Author Share Posted November 24, 2008 exactly what i needed thank you Link to comment https://forums.phpfreaks.com/topic/133985-solved-q-php-and-mysql/#findComment-697627 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.