blue-mouse
Member
Hi,
I try to write script that will run 2 times a day - the script should update column {ccjom_cc_lista_zastepstw___dzisiaj} with value 'dzisiaj' (in EN = today) if range of 2 columns :
{ccjom_cc_lista_zastepstw___data_zas_od1} -- datestart
{ccjom_cc_lista_zastepstw___data_zas_do1} -- dateend
include "today" -- todaydate
I try to do this with sheduled task - plugin php - php setup
So, this code that i write doesn't work (doesn't update column {ccjom_cc_lista_zastepstw___dzisiaj} )
Could you help me to modify this?
I try to write script that will run 2 times a day - the script should update column {ccjom_cc_lista_zastepstw___dzisiaj} with value 'dzisiaj' (in EN = today) if range of 2 columns :
{ccjom_cc_lista_zastepstw___data_zas_od1} -- datestart
{ccjom_cc_lista_zastepstw___data_zas_do1} -- dateend
include "today" -- todaydate
I try to do this with sheduled task - plugin php - php setup
So, this code that i write doesn't work (doesn't update column {ccjom_cc_lista_zastepstw___dzisiaj} )
Could you help me to modify this?
Code:
$db =& JFactory::getDBO();
$datestart = strtotime("{ccjom_cc_lista_zastepstw___data_zas_od1}");
$dateend = strtotime("{ccjom_cc_lista_zastepstw___data_zas_do1}");
$todaydate = strtotime("today");
$todayholiday = '{ccjom_cc_lista_zastepstw___dzisiaj}';
$query = "UPDATE `ccjom_cc_lista_zastepstw` SET `dzisiaj`='dzisiaj' WHERE ($datestart <= $todaydate and $dateend => $todaydate)";
//var_dump($query);exit; //uncomment for debugging
$db->setQuery($query);
$db->query();