GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 09-Jun-2004, 09:48
samvelyano samvelyano is offline
New Member
 
Join Date: Jun 2004
Posts: 1
samvelyano is on a distinguished road

Help with randomize


Hi everyone,

i need your helf with some randomize-script.
I've found a random script, which randomize the texts.
My problem is, that this script randomize every time when you load the site, but i would like that it randomize every 3 hour.
What schould i have to change, that it works?

Here is that script:

PHP Code:

<? 
$array = file("text.php"); 
shuffle($array); 
for ($i=0; $i<$zufall = rand(50, 2050); $i++) { 
echo $array[$i]; 
} 
?>


I have not so much experience with php and need your help.

Thanks

Sam
Last edited by JdS : 10-Jun-2004 at 08:28. Reason: Please enclose PHP code in [php] & [/php] for syntax highlighting
  #2  
Old 10-Jun-2004, 08:34
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
Hello samvelyano,

I would imagine that you would need to store the 'random' array in a temporary file or database table/field. Then check if the 'temp' file or randomised array has expired each time you access it, if it has expired you generate a new 'random' array and write it to a new 'temp' file or db table/field.
 
 

Recent GIDBlogToyota - 2009 May Promotion by Nihal

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 00:43.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.