Ok, I'm trying to do a query something like
select * from Order where (the order is in this week)
I don't know how to do this.
Can anyone point me in the right direction?
Check in the MySQL documentation - I think there is a function to get the week number in the year. So just compare the week number and if they are the same, then the dates are in the same week.
Diego
something like this (assuming the table "Order" has a field called "date"): <? $week = date ('W'); $sql = "SELECT * FROM Order WHERE WEEK('date') = '$week'"; ?>
sorry, I'm using php 4.0.6 not 4.1.0
I tried something like this but doesn't work:
select * from MerchantMaster where week('Signup')=week('gmdate(Y-m-d)'):::
I see week() but how do you take your date in the table without query it out to compare week('gmdate("Y-m-d")')
I have a table name MerchantMast with Date in it. I want to list all the information that is in this week
select * from MerchantMaster where week('Signup')=week('gmdate(Y-m-d)') This doesn't work 😛
You can still use Devin's example but first you need to get the week the long way.
from www.php.net:
<? function getWeek(){ $week = date +%-W; return intval($week)+1; } echo getWeek(); ?>
date +%-W
-Paul
yes, but how would you compare the data in the table you can't type select * from Merchant where SinUp=week('$today')
Because what I'm tryint to do is similar
week('SinUp')=week('$today')
but SinUp is a field name in the table, not a data variable
what type of field is SinUp in the table?
select * from Merchant where week(SinUp)=week('$today')
SinUp is a data field in the table Merchant
THx, it work