Re: Date again
| From: | Stephen | Date: | Sat, 07 Dec 2002 03:49:04 +0000 |
| Subject: | Re: Date again | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-127356@lists.php.net to get a copy of this message | ||
Not sure but I think now() doesn't return the date formate you'd want
assuming your date section is classified as a date. Here's what I would do:
$date = date("Y-m-d");
$sql = "SELECT * FROM table WHERE date='".$date"'";
$result = mysql_query($sql, $connection);
Hope it works!
----- Original Message -----
From: "Miguel Brás" <molino26@netcabo.pt>
To: <php-general@lists.php.net>
Sent: Friday, December 06, 2002 10:39 PM
Subject: [PHP] Date again
> Ok guys,
>
> having a problem here. I did my table with 6 fields, they are:
> id position name timein timeout date
>
> I have a form to insert the info on the fields, and at the date field, I
> have a drop down menu that returns me the next 7 days (the date in d/m/y),
> people will choose the date they want and that will be stored on the
table.
>
> Now I want to retrieve the position, name, timein and timeout from by
table
> and display it on a page. But I want only the records for the present
date.
> I inserted the info on my table and on the date's field I inserted
07/12/02
> and 06/12/02 just for testing
>
> I called the data via a query: SELECT position, name, timein, timeout,
date
> FROM table WHERE date=NOW()
> It was supposed that only the record from the present date was shown. But
> not, I can't have anything. Only the custom message I did if nothing was
> available
>
> What is missing here? Looked at PHP manual, time, date mktime and so on
> functions, but nothing.
> Anybody for a hand?
>
> One more thing, how can I do to prevent that different people apply for a
> same position, on the same day and during the "shift" of the first one
that
> applied?
>
> I mean, I decide to occupy the FSS position from 21:00 to 23:00 on 08th
> Decemeber.
> Someone come and try to apply also for FSS but from 19:00 to 20:30 or from
> 21:30 to 22:30. Since the position is occupied during a portion of the
> requested time or during all the requested time, how can I prevent this to
> be added on the table??
>
> Thx
> Miguel
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>