With this PHP5 Class you are now able to:
- Create an XML file from MySQL Query
- Insert all XML Content into a MySQL table
- Create/Insert work as Export/Import! So you have php-friendly way to backup data of a table
- Create sitemap from a full MySQL table or just a query
- Easy way to get class-failure errors
- Easy way to display generated xml (with or without header) and save the data into .xml file
- Full examples included
Examples
Creating XML from MySQL query:
$xml->SQLtoXML(mysql_query("SELECT * FROM your_table"));
$xml->show(3, 'your_file.xml');
Import a XML content into your MySQL table:
$xml->XMLtoSQL($xml_string, 'your_table');
Creating Sitemap:
$xml->table = 'my_table'; $xml->changefreq = 'changefreq_field'; $xml->lastmod = 'lastmod_field'; $xml->url = 'url_field'; $xml->Sitemap(); $xml->Show(3, 'sitemap.xml');
‘Catching errors’
if($count($xml->errors) > 0) {
echo 'Something went wrong!<br />';
print_r($xml->errors);
}
Rating will be really appreciated.
Questions? Suggestions? Please, don’t doubt to leave a comment!