if you insist in using your existing loop, try this (in pseudo-code) min_date = some really large date (31-Dec-2100 maybe?) max_date = some really small date (01-Jan-1970 maybe?) while (row = fetch(result)) { if (curr_date > max_date) max_date = curr_date if (curr_date < min_date) min_date = curr_date ... // other code here }
same logic can be used for numbers, strings, etc, etc. -----Original Message----- From: Miguel Cruz [mailto:[EMAIL PROTECTED]] Sent: Friday, May 10, 2002 3:13 PM To: Jason Soza Cc: [EMAIL PROTECTED] Subject: RE: [PHP] Date Q On Thu, 9 May 2002, Jason Soza wrote: > Thanks for the code, but I already have: > $result = mysql_query("SELECT * FROM table"); > > And I use while ($row = mysql_fetch_array($result)) along with extract($row) > to get my data. > > It's been my general understanding that querying twice in one script is bad. > How do I incorporate your code into my script w/o querying again? What's bad is using more database queries than you need. If you need to know two different things, query twice. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php