Create Dynamic XML Sitemaps Using PHP MYSQL

Create Dynamic XML Sitemaps Using PHP MYSQL

In this Post We Will Explain About is Create Dynamic XML Sitemaps Using PHP MYSQL With Example and Demo.Welcome on – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to xml – Creating dynamic sitemap with php and MYSQLExample

In this post we will show you Best way to implement Creating Dynamic XML Sitemaps using PHP, hear for Make Dynamic XML sitemap in PHP Scriptwith Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.


-- Table structure for table `dynemic_page`

  `dyn_page_id` int(11) NOT NULL,
  `custom_page_title` text NOT NULL,
  `my_page_url` text NOT NULL

ALTER TABLE `dynemic_page`
  ADD PRIMARY KEY (`dyn_page_id`);
ALTER TABLE `dynemic_page`
-- Dumping data for table `dynemic_page`

INSERT INTO `dynemic_page` (`dyn_page_id`, `custom_page_title`, `my_page_url`) VALUES
(1, 'Vuejs Hello World Example | Introduction — Vue.js | Vuejs Example', 'vuejs-hello-world-example-introduction-vue-js-vuejs-example/'),
(2, 'Angularjs autocomplete Textbox example – Autocomplete Directive', 'angularjs-autocomplete-textbox-example-autocomplete-directive/'),
(3, 'AngularJS and CRUD Using RESTful APIs Example\r\n', 'codeigniter-tutorial-hello-world-example-steps/'),
(4, 'AngularJS Form Validation Example\r\n', 'angularjs-form-validation-example/'),
(5, 'jQuery Basic Selectors with Adding a class to even an odd List-Elements\r\n', 'jquery-basic-selectors-adding-class-even-odd-list-elements/'),
(6, 'dependable Country-State-City Cascading dropdowns in AngularJs\r\n', 'dependable-country-state-city-cascading-dropdowns-angularjs/'),
(7, 'JSON Encoder and Decoder For JavaScript with Example\r\n', 'json-encoder-decoder-javascript-example/'),
(8, 'AngularJs Application Folder Structure\r\n', 'angularjs-application-folder-structure/'),
(9, 'How to Add and remove active class on click using AngularJS\r\n', 'add-remove-active-class-click-using-angularjs/'),
(10,'http POST method request and response in angularjs\r\n', 'http-post-method-request-response-angularjs/');  


$db_connect = mysqli_connect("localhost", "root", "live#$%^24u", "");

$sql_query = "SELECT my_page_url FROM dynemic_page";

$data_result = mysqli_query($db_connect, $sql_query);

$start_url_base = "";

header("Content-Type: application/xml; charset=utf-8");

echo '<?xml version="1.0" encoding="UTF-8"?>'.PHP_EOL; 

echo '<urlset xmlns="" xmlns:xsi="" xsi:schemaLocation="">' . PHP_EOL;

while($data_row = mysqli_fetch_array($data_result))
 echo '<url>' . PHP_EOL;
 echo '<loc>'.$start_url_base. $data_row["my_page_url"] .'/</loc>' . PHP_EOL;
 echo '<changefreq>daily</changefreq>' . PHP_EOL;
 echo '</url>' . PHP_EOL;

echo '</urlset>' . PHP_EOL;



RewriteEngine On

RewriteRule ^sitemap\.xml/?$ sitemap_index.php


I hope you have Got What is xml – Creating dynamic sitemap with php and MYSQL And how it works.I would Like to have FeadBack From My Blog( readers.Your Valuable FeadBack,Any Question,or any Comments abaout This Article( Are Most Always Welcome.

Related FAQ

Here are some more FAQ related to this Article:

  1.   Create Dynamic Sitemap Using PHP with Mysql
  2.   Laravel 6 Image Uploader and Browser for CKEditor
  3.   what does pairwise distinct mean?
  4.   Laravel 6 Inner Join Query Example - MySQL
  5.   Eloquent Join Multiple Tables using Laravel 6
  6.   PHP Laravel Get Environment Variables Example Tutorial
  7.   Increase WordPress Memory Limit using PHP
  8.   Laravel Highcharts Tutorial Example From Scratch
  9.   vuejs Radio Button on Form Submit Example
  10.   VueJS Call Function on Page Load Example