Hi there,
I am wondering how to get recors out of a mysql db from yesterday, last week
and last month. I did write a small php hack but this does not work
properly.
I did this:
###################################################
switch ($ts){
case 1: // today
$timestamp = substr($timestamp,0,8).'000000';
break;
case 2: // yesterday
$timestamp = (substr($timestamp,0,8)-1).'000000';
break;
case 3: // last week
$timestamp = (substr($timestamp,0,8)-7).'000000';
break;
};
$start_date = $timestamp;
$display_option = "AND p.timestamp > '$start_date'";
###################################################
But it leads to problems if I search for last week since I do a siple
subtraction of integer values and not of real days.
Maybe some of you guys has a better appoach?
Thanx,
Andy
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php