i want to run a query at a specific time
For Example if Time is 5:10:25 execute this query
it tried with following code
date_default_timezone_set("Asia/Calcutta");
$time=date("h:i:s");
if ($time=='04:10:00')
{
$sql="insert into bsechartsdata (TickerPlantCode,DateTime,OpenPrice,HighPrice,LowPrice,ClosePrice) select DISTINCT TickerPlantCode,DateTime,OpenPrice,HighPrice,LowPrice,ClosePrice from bsepricequotes_latest";
$query=mysql_query($sql);
}
but the query is not executing
where am doing wrong ?
Is it not better to use a cron job for this?
http://www.pantz.org/software/cron/croninfo.html
If you don’t have support for this on your “host”, then you can make a database with jobs that needs to get done. If the time is passed that is in the database, then then you do the task.