2

I need to lookup a row of data from MySQL based on the next Sunday of the week. Anyone know how?

sman591
  • 540
  • 6
  • 19

1 Answers1

6

you can determine the next sunday using PHP then pass it to your query..

$nextSunday = date("Y-m-d", strtotime('next sunday'));

if you need the next sunday from a certain date

$date = strtotime('2010-07-01');
$nextSunday = date("Y-m-d", strtotime('next sunday', $date));

The provide this date to your query

$result = mysql_query("SELECT * FROM table WHERE date = '$date'")
Rabbott
  • 4,282
  • 1
  • 30
  • 53