You are here: Getting this week from database? « All PHP « IT news, forums, messages
Getting this week from database?

Posted by Jefferis NoSpamme on 01/10/06 02:59

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:
<?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.

~~~~~~~~~~~~
Jefferis Peterson, Pres.
Web Design and Marketing
http://www.PetersonSales.com



----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация