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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.