Jump to content

[SOLVED] [Q] PHP and MYSQL


Minase

Recommended Posts

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

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'];

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.