selecting based on a month in a date
| From: | Creative Solutions New Media | Date: | Thu, 28 Aug 2003 22:19:10 +0000 |
| Subject: | selecting based on a month in a date | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-161085@lists.php.net to get a copy of this message | ||
Hi,
Asked this on the mySQL list but it seems to be more of a PHP syntax thing
that a mySQL thing.
In have the following line in PHP
<?php $today = getdate();?>
I have a mySQL table which contains dates formatted as dates(xxxx-xx-xx)
I want to select all records based on a specific month.
This is my select statement
SELECT *
FROM sti_tracking
WHERE
date = MONTHNAME('$today') = 'August'
Cased in php it looks like so...
<?php
mysql_select_db($database_sti_tracking_DB, $sti_tracking_DB);
$query_totalHitsMonth_RS_RS = "SELECT * FROM sti_tracking WHERE date =
MONTHNAME('$today') = 'August'";
$totalHitsMonth_RS_RS = mysql_query($query_totalHitsMonth_RS_RS,
$sti_tracking_DB) or die(mysql_error());
$row_totalHitsMonth_RS_RS = mysql_fetch_assoc($totalHitsMonth_RS_RS);
$totalRows_totalHitsMonth_RS_RS = mysql_num_rows($totalHitsMonth_RS_RS);
?>
but this isn't working....it's returning no records which is wrong.
Anyone see a problem?
Thx
Tim Winters
Manager, Creative Development
Sampling Technologies Incorporated (STI)
webmaster@samplingtechnologies.com
csnm@samplingtechnologies.com
W: 902 450 5500
C: 902 430 8498