I need some support as I'm not so skilled in PHP and MySQL like all in this board :) So, thanks in advance.
I'm storing data from an external parsed XML feed with a PHP script. This script update MySQL database with a CRON Job twice a day. This is a snipped of such PHP script:
mysql_query("UPDATE my_table SET amount=$jackpot->amount WHERE gameId = '".$jackpot->gameId."'")
or die(mysql_error());
This update a table and a row in my database. This table is structured like this (columns):
gameId | gameName | amount | currency | date
where the "date" column is in DATE format (dd/mm/yyyy hh:mm), CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP.
What I need... I need, yes, to update this table twice a day but I need also to INSERT a new row with the same columns at DATE change (every day, new day->new row).
I'm thinking in something similar, in two words (no coding):
if today --> update rows
elseif date change (another day, so "tomorrow") --> INSERT new row with updated data (collected from the XML feed)
How can I do this? Have I to check the current data with a MySQL query and then INSERT a new row via PHP? Or can I skip the query with a bunch of PHP lines?
Sorry, but I'm a little bit confused... Any help would be really appreciated!
Again, thanks to all!