Jump to content

[SOLVED] get_random.phtml not working with IE 7--HELP!


eabigelow

Recommended Posts

Hi--

 

I am using the following PHP code to retrieve a random text entry from a msg.dat file, but the code does not seem to work in IE 7 (but does work in FireFox, Mozilla, and Safari). It will generate two entries at random, and then it will continue to show the second entry without randomly picking any more. The code is:

 

<?php

 

srand((double)microtime()*1000000);

$filename="msg.dat";

$message=file($filename);

$select=rand(0, count($message)+1);

 

$msg = "msg=$message[$select]";

echo "$msg";

 

?>

 

Does anyone have any idea of why this is happening, and even better, how to fix it? Many, many thanks for any help!!!!

Hi--

 

Thanks for your quick reply.

 

To clarify the problem (if I can)--In Safari, etc., the get_random generates a continuous stream of randomly selected entries from the msg.dat file, one after the other; in IE 7 (and maybe earlier), the get_random will only generate 1-2 entries, and then it continues to only generate the last entry shown, again and again, in some sort of loop.

 

Just out of curiosity (I'm REALLY new to PHP, a rank beginner): I recently put a .htaccess file on the server to turn off magic quotes (using php_flag magic_quotes_gpc off). Could this have anything to do with the glitch?

 

Again, many thanks for any help!

Nah, turning magic quotes off has nothing to do with that.  If it works in every browser but IE, it's not a problem with your script, it's just that Internet Explorer is horrible, so it must be doing something quirky with the data. =/  That's very strange.  So it works in EVERY other browser you tested it in?

Yes, it works in the ones I specified. I should add that it's all contained within a Flash movie--that's where the data is entered by the user (using PHP script in an add.phtml file) and the Flash movie is where the data displays when it is randomly retrieved....

 

I don't get it...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.