Re: shedule a php script

From: Date: Sat, 05 Jun 2004 16:18:19 +0000
Subject: Re: shedule a php script
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-187688@lists.php.net to get a copy of this message
I would recommend the cronjob too but if you want to just keep the script running, do a while-loop around your code, i.e. while(1) { ... your code sleep(120); // sleep 120 seconds } --- the require should be outside of the loop IMHO ;). thomas On Sat, 5 Jun 2004 21:46:20 +0600 curlybraces@dialogsl.net (Curlybraces Technologies \ Ltd) wrote: > hi friends , > > when running this php script we can make a log file with relavent to the mysql data base. but i > need to execute this script after every 2 min time. that is mean there must be a 2 min sleep time . > can somebody help me do this function plz .........? > > > > <?php > > require ('connectMySql.php'); > > $select= " select ServiceNo, ServiceName, Status, DateTime from ServiceStatus "; > > $add_member = $db_object->query($select); > > > > $result=mysql_query($select); > while($row=mysql_fetch_array ($result)) > { > $output1 =$row['ServiceNo']; > $output2 =$row['ServiceName']; > $output3 =$row['Status']; > $output4 =$row['DateTime']; > > > $your_data .= " $output1.\t $output2 -> $output3 -> $output4 \n"; > > $output = "$your_data \n"; > > > } > > // Open the file and erase the contents if any > $fp = fopen("vas_status.log", "a"); > > > // Write the data to the file > fwrite($fp, $output); > > > // Close the file > fclose($fp); > > > if (DB::isError($add_member)) { > die($add_member->getMessage()); > } > > $db_object->disconnect(); > > ?> > > > thanx in advance > > curlys

« previous php.general (#187688) next »