![]() |
| ||
| problem with counter i have this code which is supposed to increment a counter on page <?php it is reading from text file and display the value from file but it is failing to update the file with the new value which is an increment of the counter |
| ||
| Re: problem with counter try this: <?php $open = fopen('counter.txt', 'r'); $read = fread($open, filesize('counter.txt')); fclose($open); $count = $read + 1; $open = fopen('counter.txt', 'w'); $write = fwrite($open, $count); fclose($open); echo"<table cellspacing=0 width =4% cellpadding=0 row=1 column=".strlen($count); echo"<tr>"; for ($i = 0 ;$i < strlen($count) ; $i++) { $imgsrc = substr($read,$i ,1); //display the image(s) note our images are in a folder located at //images/count1/ change this to your location echo"<td width=2%>"; echo "<img src =\"images/count1/" . $imgsrc . ".gif\">"; echo"</td>"; } echo"</tr>"; echo"</table>"; ?> |
| All times are GMT -4. The time now is 1:44 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC