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 7819849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T07:05:30+00:00 2026-06-02T07:05:30+00:00

I want to display an image from an XML request for each unique ID.

  • 0

I want to display an image from an XML request for each unique ID. A total of three images should be displayed, but I’m getting the same image three times.

The IDs are storing correctly here:

    $simIds = array(
    "id1" => $similarObject->place[0]['place_id'],
    "id2" => $similarObject->place[1]['place_id'],
    "id3" => $similarObject->place[2]['place_id'],
);

Here’s my foreach loop:

foreach ($simIds as $foo) {
    $simPhotoFile = $photoUrl.$foo;
    $simPhotoObject = simplexml_load_file($simPhotoFile);
    $simPhotoSrc = array (
        'src1' => $simPhotoObject->photos->photo_set->square,
        'src2' => $simPhotoObject->photos->photo_set->square,
        'src3' => $simPhotoObject->photos->photo_set->square,       
    );  
}

The relevant HTML:

<p><img src="<?= $simPhotoSrc['src1'] ?>" alt="Image load failed" /><img src="<?= $simPhotoSrc['src2'] ?>" alt="Image load failed" /><img src="<?= $simPhotoSrc['src3'] ?>" alt="Image load failed" /></p>

Im not really sure what I’m doing wrong at this point, or if there is maybe a better way to go about this. Thanks for any help!

  • 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-02T07:05:32+00:00Added an answer on June 2, 2026 at 7:05 am
    $simPhotoSrc = array();
    foreach ($simIds as $foo) {
        $simPhotoFile = $photoUrl.$foo;
        $simPhotoObject = simplexml_load_file($simPhotoFile);
        $simPhotoSrc[] = $simPhotoObject->photos->photo_set->square
    }
    

    html:

    <p><img src="<?= $simPhotoSrc[0] ?>"/><img src="<?= $simPhotoSrc[1] ?>" /><img src="<?= $simPhotoSrc[2] ?>" /></p>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am parsing the public timeline xml from twitter and want to display images
I want to display a simple GIF image in a VBox using GTK+ from
I want to display images on a .net page which I load from database
I have an JSP page where I want to display an image from a
I want to get the Bitmap from URL like - https://graph.facebook.com/100003506521332/picture I tried how-i-can-display-images-from-url-in-blackberry
I want to display image using base64 encoding in IE using GWT If it
I want to display .jpg image in an Qt UI. I checked it online
I want to display an image using this php script on my server. $file
I want to display an image at the bottom of the screen and make
I want to display an image in my MKMapView instead of little rock pin

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.