Dear Folks and Friends,
I screwed up somewhere and had this code working before, but now, everything has fallen apart. I have a simple MySql database which has the calendar week's first date starting on monday, with columns for restaurants, and the format is as follows
Calweek_date Restaurant1 Restaurant2 etc...
2006-01-09 menu1 menu2 etc...
I'm trying to pull this week's menu from the current week's date which begins on monday.
This may be a problem of simple syntax and it was working before Christmas break, but not now.
Quote:
quote:<?php
mysql_select_db($database_utMenuCal, $utMenuCal);
$query_thisweek = "SELECT * FROM utCalMenu WHERE DATE_FORMAT(utCalMenu.Calweek_date,'%v') = '".date("W")."' ";
$thisweek = mysql_query($query_thisweek, $utMenuCal) or die(mysql_error());
$row_thisweek = mysql_fetch_assoc($thisweek);
$totalRows_thisweek = mysql_num_rows($thisweek);
?>
|
<?php echo $row_thisweek; ?> returns no value for this week. And the query returns no data at all.
If I use this query: SELECT * FROM utCalMenu WHERE DATE_FORMAT(utCalMenu.Calweek_date,'%v') all data in all rows are returned, not just the current week. So it is working to a point, but something is breaking down in the conversion to the current week...
Any help DEEPLY appreciated.
~~~~~~~~~~~~~
http://www.petersonsales.net