eabigelow Posted April 24, 2008 Share Posted April 24, 2008 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!!!! Link to comment https://forums.phpfreaks.com/topic/102700-solved-get_randomphtml-not-working-with-ie-7-help/ Share on other sites More sharing options...
DarkWater Posted April 24, 2008 Share Posted April 24, 2008 PHP is server side, so browser shouldn't matter. Link to comment https://forums.phpfreaks.com/topic/102700-solved-get_randomphtml-not-working-with-ie-7-help/#findComment-525925 Share on other sites More sharing options...
eabigelow Posted April 24, 2008 Author Share Posted April 24, 2008 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! Link to comment https://forums.phpfreaks.com/topic/102700-solved-get_randomphtml-not-working-with-ie-7-help/#findComment-525942 Share on other sites More sharing options...
DarkWater Posted April 24, 2008 Share Posted April 24, 2008 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? Link to comment https://forums.phpfreaks.com/topic/102700-solved-get_randomphtml-not-working-with-ie-7-help/#findComment-525952 Share on other sites More sharing options...
eabigelow Posted April 24, 2008 Author Share Posted April 24, 2008 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... Link to comment https://forums.phpfreaks.com/topic/102700-solved-get_randomphtml-not-working-with-ie-7-help/#findComment-525973 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.