There is a table to hold last update date in database:
$syncDate = "CREATE TABLE IF NOT EXISTS sync_info (last_sync TIMESTAMP DEFAULT '2003-01-01 00:00:00')";
And i’m updating it every time:
$dateUpdate = "UPDATE sync_info SET last_sync = NOW()";
Date is needed for data search:
$query = "SELECT * FROM results WHERE InsertionDate BETWEEN '$startDateToSearch' AND NOW()";
where insertion date is also a timestamp in table.
The problem is stupid, but I can’t get proper startDateToSearch from database. It always returns integer and I can’t use it for data search in that way…
$startDate = "SELECT * FROM sync_info";
$startFind = mysql_query($startDate, $GLOBALS['con']);
$array = mysql_fetch_array($startFind);
$row = $array[0];
$startDateToSearch = $row['last_sync'];
What I’m doing wrong???
Why not just use SQL in one statement, such as