RE: [PHP] Date Q
| From: | Martin Towell | Date: | Fri, 10 May 2002 05:27:29 +0000 |
| Subject: | RE: [PHP] Date Q | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-96907@lists.php.net to get a copy of this message | ||
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:mnc@stoic.net]
Sent: Friday, May 10, 2002 3:13 PM
To: Jason Soza
Cc: php-general@lists.php.net
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