Pulling record by time of day
| From: | mike at wkla dot com | Date: | Mon, 04 Mar 2002 00:03:33 +0000 |
| Subject: | Pulling record by time of day | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-17432@lists.php.net to get a copy of this message | ||
Hello,
I've been working on pulling one or more records from my db by the time of
day. Here is what I've tried so far,
<?
$time = date("Hi");
if (900<=$time<=1500) {$time = 1;}
?>
I would then use $time in a query like this,
$result = mysql_query("SELECT * FROM table WHERE id= $time",$db);
But I can't get the IF statement to work, I've tried several different
variations. All I get is parse errors. I not sure how to add the second <=.
When I do this,
if (900<=$time) {$time = 1;}
it works.
Thanks in advance for the help,
Mike
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.319 / Virus Database: 178 - Release Date: 1/28/02