Dates in MYSQL
| From: | Alex Francis | Date: | Wed, 17 Apr 2002 16:20:43 +0000 |
| Subject: | Dates in MYSQL | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-18605@lists.php.net to get a copy of this message | ||
Got my select statement to work as follows:
$query = ' SELECT * FROM notices WHERE TO_DAYS(eventdate) >= TO_DAYS(now())
order by eventdate';
Now trying to get the date more user friendly and tried:
$query = ' SELECT id, eventheading, DATE_FORMAT("eventdate", "%D %M
%Y")FROM
notices WHERE TO_DAYS(eventdate) >= TO_DAYS(now()) order by eventdate';
$result=mysql_db_query($dbname, $query, $link);
if (!$result) { echo( mysql_error()); }
else
while ($row = mysql_fetch_array($result))
$entername = "$row[entername]";
$date = "$row[enterdate]";
$eventdate = "$row[eventdate]";
$eventheading = "$row[eventheading]";
$eventbody = "$row[eventbody]";
$id = "$row[id]";
When I echo ($eventdate) I get nothing. Not even an error.
--
Alex Francis
Cameron Design
35, Drumillan Hill
Greenock PA16 0XD
Tel 01475 798106
afrancis@camerondesign.co.uk
http://www.camerondesign.co.uk
This message is sent in confidence for the addressee only. It may contain
legally privileged information.
Unauthorised recipients are requested to preserve this confidentiality and
to advise the sender
immediately of any error in transmission.