Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6947071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:38:47+00:00 2026-05-27T13:38:47+00:00

at the moment I’ve got a simple bit of code to display messages on

  • 0

at the moment I’ve got a simple bit of code to display messages on a site.
the page includes an iframe that self refreshes every 90 seconds, and the iframe displays the contents of a mysql table limited to the most recent (30) posts.

I’ve been reading up on ajax and it still confuses me, i’ve never got it working properly, and would like to know, for a small task like this, is it really worth it ?

<head>
<META HTTP-EQUIV="refresh" CONTENT="90; URL=">
</head>
<body>
<? 
$newsarray = array();
$sql = "SELECT * FROM `news` ORDER BY `date` DESC LIMIT 30";
$result = mysql_query($sql);
if(mysql_error()) { print mysql_error(); } else {
    while($stuff = mysql_fetch_assoc($result)) 
{ array_push($newsarray, $stuff); }

foreach($newsarray as $newsstory) { ?>
<div class="newsstory">
    <h2><? echo $newsstory['headline']; ?></h2>
    <div><? echo $newsstory['story']; ?></div>
    <label>By <? echo $newsstory['user']; ?> on <? echo $newsstory['date']; ?></label>
</div>  
<? } ?>
</body>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T13:38:48+00:00Added an answer on May 27, 2026 at 1:38 pm

    It would be as simple as adding the jQuery library to your exsiting page and adding the following code:

    <div id="result"></div>
    <a href="javascript: updatestuff();">Manually Fetch Page</a>
    
    <script language="javascript">
    function updatestuff() {
        $.ajax({
            url: 'mypage.php', // The source
            cache: false, // Make sure results are not cached
            success: function (data) {
                $('#result').html(data); // Update data once retrieved
            }
        });
    }
    
    setInterval("updatestuff()",90000); // In Milliseconds
    </script>
    

    This would run the function updatestuff() every 90 seconds which would update the <div> with content fetched from mypage.php.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

At the moment I have some test code that starts something like this: CheckBoxPreference
So at the moment I have a simple reminder app that you enter some
At the moment I am using the following bit of code to only get
At the moment I have a page that outputs a bunch of records held
There is a moment in my app, that I need to force to show
Okay at the moment I my self am new to programming and learning it
At the moment I'm using this code /usr/libexec/PlistBuddy -c Set PreferenceSpecifiers:1:DefaultValue $productVersion Test/Settings.bundle/Root.plist in
At the moment I use the following code to convert dynamic URLs to static
At the moment I am generating a barcode using Shay Anderson's class (http://www.shayanderson.com/php/php-barcode-generator-class-code-39.htm) and
At the moment, I have PHP code which allows user1 to pay user2. If

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.