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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:16:07+00:00 2026-05-28T07:16:07+00:00

I came up with a PHP version of a sitemap file for my dynamic

  • 0

I came up with a PHP version of a sitemap file for my dynamic site which only has index.php. Here is the result: http://www.oddsnavigator.eu/sitemap.php

Now I need a way to either export those results to sitemap.xml file, or to make this one XML and Google-friendly. Here’s the code:

<?PHP
$SQL="boring query";
$num_rows = mysql_num_rows(mysql_query($SQL));
echo $num_rows , "</BR>";
$result = mysql_query($SQL);
if($result === FALSE) { die(mysql_error());}

while($db_field=mysql_fetch_assoc($result)) {
$goto = "http://oddsnavigator.eu/?display=0&sport=" . $db_field['sportid'] . "&day=all&league=" . $db_field['stageid'];
$title = $db_field['sportname'] . " " . $db_field['tempname'] . " " . $db_field['stagename'] . " Sports Betting Odds Comparison - OddsNavigator.eu";

echo "<a href='$goto' title='$title'>" , $db_field['sportname'] , " " , $db_field['tempname'] , " " , $db_field['stagename'] , "</a>" , "</BR>";
}
?>

Any ideas?

  • 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-28T07:16:07+00:00Added an answer on May 28, 2026 at 7:16 am

    In Your code $goto contains URLs, store all these url in an array called $urls and then use following function.
    I expect the code goes in class, if not replace $this->variable with $variable.

    //$urls = array();
    $compress = true;
    
    function save () 
    {
        if (empty($this->urls)) return;
        $file = "sitemap.xml{$this->compress}";
        $xml = '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
        $xml .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n";
        foreach ($this->urls as $url) 
        {
            $xml .= '  <url>' . "\n";
            if (is_array($url)) {
                foreach ($url as $key => $value) $xml .= "    <{$key}>{$value}</{$key}>\n";
            } 
            else {
                $xml .= "    <loc>{$url}</loc>\n";
            }
            $xml .= '  </url>' . "\n";
        }
        $xml .= '</urlset>' . "\n";
        $this->urls = array();
        if (!empty($this->compress)) $xml = gzencode($xml, 9);
        $fp = fopen(BASE_URI . $file, 'wb');
        fwrite($fp, $xml);
        fclose($fp);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just came across NetBeans site and found its PHP and Ruby IDEs. I
My system has two PHP interpreters. One came bundled with the OS and the
I came across a php article about regular expressions which used (.*?) in its
So I came across this bit of php code: <?php $long_url = http://example.com; $bit_ly
Can I get information from which web site is came request to read XML
I have a string in PHP (came from some data source), which represents a
Here's an image: The HTML is in a php which is as follows: print
Our site is using PHP Version 5.2.14 Lately our hoster probably changed magic-quote defenition,
I came from PHP language(codeigniter), but now I learning ASP.Net MVC :) In PHP
I have installed MAMP and the PHP it came with wasn't compiled with ncurses

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.