I encountered something similar. Here is a snippet of code: $tdate=date("Y\\-m\\-d"); $time=date("G\\:i\\:s");
$query="insert into trackinginfo (IP_Address, username, date, Time, Processed, CommentFlag) values ('$REMOTE_ADDR', '$username', '$tdate', '$time', 'N', '$commentExists')"; mysql_query($query) or die(mysql_error()); //RecordID is an auto incrementing primary key. $query="select RecordID from trackinginfo where IP_Address='$REMOTE_ADDR' and username='$username' and date='$tdate' and Time= '$time'"; //used those variables as they are static for the page. And yes, that is a bit of overkill you see there. $result = mysql_query($query) or die(mysql_error()); $dummyvar = mysql_fetch_object($result); $sid=$dummyvar->RecordID; "Cj" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > is there any way to determine the primary key of a row after it's added to a > table in mysql? > > i need to do this because i have another table which requires the id from > one table as a foreign key. > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php