RE: [PHP] dates
| From: | Maxim Maletsky | Date: | Mon, 16 Apr 2001 09:45:18 +0000 |
| Subject: | RE: [PHP] dates | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-48720@lists.php.net to get a copy of this message | ||
Why don't you look into mYSQL documentation and rewrite your queries,
you might be able to end up with one only single query and 3 lines of PHP,
instead of the whole bunch as you're trying to do.
The reason I advise you that is that mySQL plays some really sweet games
with dates, while PHP treats them as simple set of integers...
Hope it helps.
Sincerely,
Maxim Maletsky
Founder, Chief Developer
PHPBeginner.com (Where PHP Begins)
maxim@phpbeginner.com
www.phpbeginner.com
-----Original Message-----
From: Alvin Tan [mailto:alvintan@inscribe.com.my]
Sent: Monday, April 16, 2001 4:21 PM
To: Php-General
Subject: [PHP] dates
hi all,
a little stuck here. trying to pull a bunch of unix timestamps out and show
only those that show up today. problem is that when i hit the first match,
the rest of the dates don't show. code follows:
======================
$sql = "SELECT * FROM dates";
$result = mysql_query($sql) or mysql_die();
while ($a = mysql_fetch_array($result))
$showsID = $a[showsID];
$ts = $a[timestamp];
$endTime=(spanDay ($ts)); // function that adds 24hrs to initial stamp to
make the end of day time.
$today = time();
if (($endTime >= $today)&&($ts <= $today))
{
$sq = "SELECT * FROM shows WHERE id=$showsID";
$result = mysql_query($sq) or mysql_die();
$b = mysql_fetch_array($result);
print "<br><font color=red>$b[name]</font><br>";
}
}
======================
thanks in advance,
@lvin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net