Jump to content

reload div


alapimba

Recommended Posts

Hello i have a div on my site that i want to reload 10 in 10 seconds.

How can i do that?

 

the div content is this:

 

 <div id="load_tweets"><p class="style1"><?php echo $row_Recordset3['conselhos_txt']; ?></p></div>

 

That recordset has:

$query_Recordset3 = "SELECT * FROM conselhos ORDER BY RAND()";

 

So i just need to print a random quote from my database 10 in 10 seconds.

 

anyone to help me?

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/180392-reload-div/
Share on other sites

That is not a very efficient way to do this, and RAND() is known to cause performance problems. It actually depends on your dataset, the larger the data the slower RAND() becomes. If I had a huge dataset of quotes, I would set up a cron job to generate a file of 30 or so quotes every half hour, then cycle through those randomly. To the user it will look completely random each time, but to you it means a savings of (n-1) database hits per half hour where n = page loads during that time.

Link to comment
https://forums.phpfreaks.com/topic/180392-reload-div/#findComment-951856
Share on other sites

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.