News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Display autoincrement value from new row.

Started by dschwab9, August 13, 2004, 12:29:05 AM

Previous topic - Next topic

dschwab9

I have a registration script that inserts a users data into a mysql table.  I have a REG_ID column, which is set to auto-increment, and I want to display to the user the value of that column after the form is submitted.  This is what I'm using the insert the data:

$sql = "INSERT INTO fall04
(`firstName`,`lastName`,`email`,`bbsName`,`state`,`firstTime`,`numAdults`,`numKids`,
`year`,`make`,`model`,`camp`,`dinner`,`days`,`group`,`sponser`,`firstName2`,`lastName2`,
`year2`,`make2`,`model2`,`comments`)
VALUES
('".$firstName."','".$lastName."','".$email."','".$bbsName."','".$state."',
'".$firstTime."','".$numAdults."','".$numKids."','".$year."','".$make."',
'".$model."','".$camp."','".$dinner."','".$days."','".$group."','".$sponser."',
'".$firstName2."','".$lastName2."','".$year2."','".$make2."','".$model2."',
'".$comments."')";
$sql_result = mysql_query($sql, $connection) or die(mysql_error());


Once the row is inserted, how do I find out the value if REG_ID so I can display it to the user?

[Unknown]


Advertisement: