php-db | 2002091
Date: 09/02/02
- Next message: Shoulder to Shoulder Farm: "Re: [PHP-DB] Re: What's wrong with this code?"
- Previous message: Heiko Mundle: "[PHP-DB] mssql: insert a record and return the auto increment ID"
- Next in thread: Jed Verity: "Re: [PHP-DB] gettin records from today, yesterday, etc."
- Reply: Jed Verity: "Re: [PHP-DB] gettin records from today, yesterday, etc."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Next message: Shoulder to Shoulder Farm: "Re: [PHP-DB] Re: What's wrong with this code?"
- Previous message: Heiko Mundle: "[PHP-DB] mssql: insert a record and return the auto increment ID"
- Next in thread: Jed Verity: "Re: [PHP-DB] gettin records from today, yesterday, etc."
- Reply: Jed Verity: "Re: [PHP-DB] gettin records from today, yesterday, etc."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

