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

  • Home
  • SEARCH
  • 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 9236481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T07:18:11+00:00 2026-06-18T07:18:11+00:00

I have a single image embedded on a page that is drawn from a

  • 0

I have a single image embedded on a page that is drawn from a mysql database that holds the filename. What’s I’d like to do is use javascript to call let’s say pump.php to bring in the absolute next image in the database – sort of like a slide show and then dynamiclly write that to the img src. i’m close but stumped. Any help is mega appreciated and I searched and searched! Here is the div/embedded image:

<div id="image_holder"><img id=target src=./watch/<? echo $frame; ?> /></div>

Then i have this javascript, that after 1000 ticks of the clock calls function kitty. Kitty is supposed to refresh pump.php which contains php along with the ID number (let’s assume it starts with 1, the first record and then write to the HTML above the new image name dynamically:

 setInterval("kitty()",1000);

 function kitty(){

 $.get('pump.php?id=<? echo $id; ?>', 
  { lastupdate: 1 }, 
  processUpdate, 'html');
  }, 1000 ) };

 var target_image = document.getElementById("target");
  target_image.src = <? echo $image ?>; 
}

Here is the pump.php (minus the database connection info) it supposed to pull the image where the ID = the current ID of the script and also increment ID by one so that way we can start at 2 next time!

$result = mysql_query( "SELECT * FROM frame_database where id=$id " );
$data = mysql_fetch_array($result); 
$image = $data["image"]; 
$id++;

What do you guys think? am I faaaaaaaaaaaar from the tree?

  • 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-06-18T07:18:12+00:00Added an answer on June 18, 2026 at 7:18 am

    First off pump.php needs to return data to the script so that the script can get the imagename.

    $result = mysql_query( "SELECT * FROM frame_database where id=$id " );
    $data = mysql_fetch_array($result); 
    $image = $data["image"]; 
    $id++;
    echo json_encode(array('image'=>$image, 'id'=>id));
    

    Then in kitty() you can do:

    $.get('pump.php?id=<? echo $id; ?>', 
          { lastupdate: 1 }, 
          function(data){
                var res = JSON.parse(data);
                var target_image = document.getElementById("target");
                target_image.src = res.image; 
          }, 'html');
    

    Note that you will probably want to change the <? echo $id; ?> part to be a javascript variable that the get call in kitty() can update.

    Hope this helps.

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

Sidebar

Related Questions

I have a few iFrames that all use a single background image. Whenever I
i have single php dynamic page that load image each time app user is
i have implemented a code that fetch single image from 1000+ images. The image
In my app, I want to have a single background image that I use
I have a single image file in a folder in my Eclipse project that
I have a single image covering the entire background. Do sites that do this
I have an image upload page (single page). When submitted it check filesize and
We suppose that we have the following image (is a single file with 4
I have A single page that has the following structure <form runat=server><placeholder></placeholder></form> I have
Friend's, I have an single image in which it set has screen home page

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.