>On Tue, Jul 02, 2002 at 11:08:13AM +0530, Sachin Keshavan wrote:
>>
>> I am trying to execute the Query
>> SELECT MAX(RECORDNO) AS MAXREC FROM BOOKS;
>>
>> while($row = mysql_fetch_array($sql_result))
>> {
>> $bookID = $row['MAXREC'];
>> }
>>
>> This query fails. Am I doing any thing wrong here.
Warning: In addition to any SQL error you may have, you almost-for-sure are
making a newbie logical flaw in your programming.
Let me ask you this question:
What if *TWO* (2) people add new books at *EXACTLY* the same time?
Do you *STILL* want the MAX(RECORDNO) ?
Or am I gonna get the other guy's book, since his went in a micro-second
after mine did?
:-)
You may want to look into this function:
http://www.php.net/manual/en/function.mysql-insert-id.php
I could, of course, be wrong, and you're not making the same mistake a
million others have made before... :-)
--
Like Music? http://l-i-e.com/artists.htm
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php