![]() |
VOOZH | about |
In this article, we are going to store data present in XML file into MySQL database using PHP in XAMPP server.
XML: Extensible Markup Language (XML) is a markup language that defines a set of rules for encoding documents in a format that is both human-readable and machine-readable. The design goals of XML focus on simplicity, generality, and usability across the Internet.
Example:
Loading XML file: We will use simplexml_load_file() function to convert the well-formed XML document into the given file to an object.
Syntax:
SimpleXMLElement simplexml_load_file( string $filename, string $class_name = "SimpleXMLElement", int $options = 0, string $ns = "", bool $is_prefix = FALSE )
Steps to Write and Execute code:
Filename: input.xml
Filename: index.php
Execution steps:
1. Save 2 files in one folder in path: xampp/htdocs/gfg
2. Type localhost/gfg/index.php and see the output
Now check the data in xml stored in our database or not