Question: how to export data from database to xml file in php?
Answer: Connect to database using mysqli. First you need to connect to database using mysqli method. ...  Select records from books table. Next to select records from books table. ...  Create XML file using createXMLfile() function. Finally to generate XML file using php DOMDocument class a function createXMLfile is created.