MySQL Php get id question
Posted: Fri Oct 01, 2004 11:55 pm
feyd | Please use
What I need is the pick_id... anyone know the best way to get it?
feyd | Please use
Code: Select all
tags when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
Let's say you just inserted a new row of information and your id or primary key is auto incrementing... how can you then grad that id to use in later scipts to perform other processes and logic?
Here is an example:Code: Select all
// Insert data into database
$sql = 'INSERT INTO `picks` ( `team_name` , `team_location` , '.$bet.' , `bet_desc` , `bet_weight` , `comments` , `game_date` , `modify_date` ) '
. ' VALUES ( '''.$_POST['team_name'].''', '''.$_POST['team_location'].''', '''.$_POST['play'].''', '''.$_POST['play_desc'].''', '''.$_POST['weight'].''', '''.$_POST['comments'].''', '''.$_POST['game_date'].''', NOW( ) );'
. ' ';
$result = mysql_query($sql)or die (mysql_error());feyd | Please use
Code: Select all
tags when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]