Re: [PHP-DB] grabbing id from new record

2002-01-14 Thread Ireneusz Piasecki
Hi. What about Auto_increemnt field ?? Your's id can be auto_increment field. for example: create table dupencja (id int(7) auto_increment not null, primary key(id)); so when you insert records: insert into dupencja values('') - id will be 1 insert into dupencja values('') - id will be 2 this

Re: [PHP-DB] grabbing id from new record

2002-01-14 Thread George Pitcher
I am sorry, I was not clear in my original request. The id is auto-incremented. I want to grab the id so that I can use it as part of a redirect $q2=select Course_ID from course where HEI_ID = '$inst' order by Course_ID desc limit 0,1; $result2=mysql_query($q2) or die(q2 failed); while

RE: [PHP-DB] grabbing id from new record

2002-01-14 Thread matt stewart
] Subject: Re: [PHP-DB] grabbing id from new record I am sorry, I was not clear in my original request. The id is auto-incremented. I want to grab the id so that I can use it as part of a redirect $q2=select Course_ID from course where HEI_ID = '$inst' order by Course_ID desc limit 0,1; $result2

Re: [PHP-DB] grabbing id from new record

2002-01-14 Thread George Pitcher
Thanks, just what I was looking for. George - Original Message - From: matt stewart [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, January 14, 2002 3:26 PM Subject: RE: [PHP-DB] grabbing id from new record straight after you do the insert command, use the call: $ID

Re: [PHP-DB] grabbing id from new record

2002-01-14 Thread Sam Masiello
That actually isn't a safe way to do it. Consider the following scenario: Insert A occurs generating row Y in your table. Insert B occurs generating row Z in your table. select occurs (after insert A) to grab last ID inserted...your result is the ID from row Z. select occurs (after insert B),

Re: [PHP-DB] grabbing id from new record

2002-01-14 Thread George Pitcher
queries. That was why the WHERE user='$user' was there. George - Original Message - From: Sam Masiello [EMAIL PROTECTED] To: George Pitcher [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, January 14, 2002 3:21 PM Subject: Re: [PHP-DB] grabbing id from new record That actually isn't