How to read XML file in PHP


<?php
$str = <<<XML
<currencies>
    <currency name="US dollar" code_alpha="USD" code_numeric="840" />
    <currency name="Euro" code_alpha="EUR" code_numeric="978" />
</currencies>
XML;

$dom = new DOMDocument();
$dom->loadXML($str);

foreach($dom->getElementsByTagName('currency') as $currency)
{
    echo $currency->getAttribute('name'), "\n";
    echo $currency->getAttribute('code_alpha'), "\n";
    echo $currency->getAttribute('code_numeric'), "\n";
    echo "+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+\n";
}
?>


Warning: Undefined variable $article_id in /var/www/html/st/includes/get_article.php on line 9

Fatal error: Uncaught mysqli_sql_exception: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 6 in /var/www/html/st/includes/get_article.php:9 Stack trace: #0 /var/www/html/st/includes/get_article.php(9): mysqli_query() #1 /var/www/html/st/php/php-file-read-xml.php(110): include('...') #2 {main} thrown in /var/www/html/st/includes/get_article.php on line 9