Home > Jobs > Technology > Programming > Codeigniter > Create Dynamic XML Sitemaps Using PHP MYSQL

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 Pakainfo.com – 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!.

Also Read :  Create Dynamic Sitemap Using PHP with Mysql


-- 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", "Pakainfo.com");

$sql_query = "SELECT my_page_url FROM dynemic_page";

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

$start_url_base = "https://pakainfo.com/tutorial/php-sitemap/";

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

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

echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">' . 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

:: Related Posts ::


Also Read :  JavaScript GROUP BY Function with Example

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(Pakainfo.com) readers.Your Valuable FeadBack,Any Question,or any Comments abaout This Article(Pakainfo.com) Are Most Always Welcome.

Jaydeep Gondaliya
Hi, Iā€™m Web developer, PHP developer.Pakainfo.com is the most popular Programming & Web Development blog. Our mission is to provide the best online resources on programming and web development.Any visitors of this site are free to browse our tutorials, live demos, Examples and download scripts.If you have a project that you want to get started, launch quickly, contact me. Email : [email protected]

Leave a Reply

Your email address will not be published. Required fields are marked *