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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:11:55+00:00 2026-06-04T04:11:55+00:00

So i am generating a XML file based on data from mysql tables but

  • 0

So i am generating a XML file based on data from mysql tables but need to be able to get the data i want from 2 tables using my query and unsure how to do this. details are as follows:

TABLE: store_locations
===================================
store_location_id
country
latitude
longitude
===================================

TABLE: store_locations_descriptions
===================================
store_location_id
name
description
city
===================================

PHP Function:

// Function to generate XML file based on store data from database
function fn_store_locator_generate_xml(){
    $qur = db_get_field("JOIN QUERY WANTED HERE");
    $ans=mysql_query($qur);
    $output.= "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<kml xmlns=\"http://earth.google.com/kml/2.2\">
<Document>";
    while($row=mysql_fetch_array($ans))
    {
      $output.="<name>".$row['name']."</name>";
      $output.="<description>".$row['description']."</surname>";
      $output.="<Placemark>";
      $output.="<name>".$row['name']."</name>";
      $output.="<Snippet>".$row['description']."</Snippet>";
      $output.="<description>".$row['description']."</description>";
      $output.="<Point>";
      $output.="<coordinates>".$row['latitude'].",".$row['longitude']."</coordinates>";
      $output.="</Point>";
      $output.="</Placemark>";
      $output.="</person>";
    } 
    $output.="</Document>";

    $file_name = "galleries.xml";
    $file_pointer = fopen($file_name, "w+");
    fwrite($file_pointer, "$output");
    fclose($file_pointer);
}
// generate the XML file
fn_store_locator_generate_xml();

Many Thanks in advance!

  • 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-04T04:11:56+00:00Added an answer on June 4, 2026 at 4:11 am

    Looks like you just need a join. I’m assuming you have 1 to 1 relationship between these tables.

    select s.store_location_id,
        s.country,
        s.latitude,
        s.longitude,
        d.name,
        d.description,
        d.city
    from store_locations s
        join store_locations_descriptions d
        on s.store_location_id = d.store_location_id
    

    You should certainly look into how joins work:
    http://www.keithjbrown.co.uk/vworks/mysql/mysql_p5.php

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

Sidebar

Related Questions

From my VB application I am generating XML document based on data fetched from
I am generating json from an xml file using the Newtonsoft dll. From the
I am generating an XML file from a VB.NET app. The document was generating
Generating normal columnar data in excel file is quite easy but does any one
I have a PHP file which produces an Xml sitemap based on data which
I am generating the xml file using the DOM and the program is working
I am generating an XSD file based on the columns in my xml. I
I am generating C code based on information provided by another file (an XML
i want to fetch xml file from the links like http://api.worldbank.org/countries/GBR/indicators/NY.GDP.MKTP.KD.ZG?date=2004:2012 it returns a
Hi I have following which is not generating class file for complextypes using bindigs.xml

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.