twilitegxa Posted September 25, 2008 Share Posted September 25, 2008 I have this hit counter script, and it works fine, except for the part that is supposed to display the words, "You are visitor number" before the hits. Here is the code: <?php //Opening file to get counter value $fp = fopen ("counter.txt", "r"); $count_number = fread ($fp, filesize ("counter.txt")); fclose($fp); ?> <html> <head> <title>Counter number</title> </head> <body> <?php $i=""; $ImgPath="imgs/"; //Path of image folder $counter = (int)($count_number) + 1; $count_number = (string)($counter); $len = strlen($count_number); while($len!=$i && $len!=0) { echo "<img src=".$ImgPath.$count_number[$i].".jpg alt=\"You are visitor number $count_number\" width=20 Height=22>"; $i++; } $fp = fopen ("counter.txt", "w"); fwrite ($fp, $count_number); fclose($fp); ?> </body> </html> Can anyone tell me why it's not displaying? Quote Link to comment Share on other sites More sharing options...
trq Posted September 25, 2008 Share Posted September 25, 2008 echo "<img src='" . $ImgPath.$count_number[$i] . ".jpg' alt='You are visitor number $count_number' width=20 Height=22>"; Quote Link to comment Share on other sites More sharing options...
twilitegxa Posted September 25, 2008 Author Share Posted September 25, 2008 For some reason that didn't work. Nothing changed. Any other suggestions? Quote Link to comment Share on other sites More sharing options...
trq Posted September 25, 2008 Share Posted September 25, 2008 What does that part of the output look like when you view the html source? Quote Link to comment Share on other sites More sharing options...
peranha Posted September 25, 2008 Share Posted September 25, 2008 isnt alt='' when the image cannot be found, it puts that in its place??? Quote Link to comment Share on other sites More sharing options...
Stryves Posted September 25, 2008 Share Posted September 25, 2008 alt='' is used to display text when the mouse hovers over the image, it's also used for Blind users who use programs that read the text on the page. Quote Link to comment Share on other sites More sharing options...
twilitegxa Posted September 25, 2008 Author Share Posted September 25, 2008 Okay, so that's probably why nothing is displaying. Didn't even think about that. LOL Thanks guys! Quote Link to comment 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.