znopie Posted December 8, 2008 Share Posted December 8, 2008 Hello all, I'm doing a little code which should be able to check the status of price update. My price update file contains more than 9999999 prices, and I would therefore like that when I appreciate the update starts, then I just Update forward, and when I touch it says it "reads ($instUpdate->instLine+1) lines " Hope you can help <?php /* START */ set_time_limit(0); class instUpdate { public $instFile, $instLine=0; // instLine is where to start public function start() { $idfyFile = file_get_contents($this->instFile); $lineFile = explode("\n", $idfyFile); for ($i = $this->instLine; $i < count($lineFile); $i++) { $this->instLine++; $price['name'] = substr($lineFile[$i], 50,33); $price['price'] = substr($lineFile[$i], 42,; $indhold = trim($price['name']).";".number_format($price['price']/100, 2, ",", ".")." DKK\n"; $fil = fopen("pris.csv", "a"); fwrite($fil, $indhold); fclose($fil); } } } $instUpdate = new instUpdate(); $instUpdate->instFile = 'pris.txt'; // Pris = Price if ($_POST['update']) { $instUpdate->start(); echo "<center>Reads: <b>".($instUpdate->instLine+1)."</b> lines<br /><form action=\"".$_SERVER['PHP_SELF']."\" method=\"post\"><input type=\"submit\" name=\"update\" value=\"Update\" style=\"width:115px;padding:2px;\" /></form></center>"; } elseif ($_POST['start']) { $instUpdate->start(); echo "<center><form action=\"".$_SERVER['PHP_SELF']."\" method=\"post\"><input type=\"submit\" name=\"update\" value=\"Update\" style=\"width:115px;padding:2px;\" /></form></center>"; } else { echo "<center><form action=\"".$_SERVER['PHP_SELF']."\" method=\"post\"><input type=\"submit\" name=\"start\" value=\"Start price update\" style=\"width:150px;padding:2px;\" /></form></center>"; } /* END */ ?> Quote Link to comment https://forums.phpfreaks.com/topic/136071-see-status-on-update/ Share on other sites More sharing options...
znopie Posted December 9, 2008 Author Share Posted December 9, 2008 Someone who can help ??? Quote Link to comment https://forums.phpfreaks.com/topic/136071-see-status-on-update/#findComment-710412 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.