title: Generating XML from SQL using Mysqli
body: <p>I'm trying to pull all the data from my users table and display it in XML format. The connection works fine and everything as I have a login and registration set up fine, but I can't seem to get this to display anything other than a white screen.</p>
  
  <p>I've found lots of different tutorials on how to do it with mysql but not mysqli. what am i missing?</p>
  
  <p><strong>generatexml.php</strong></p>
  
  <pre><code> &lt;?php
  include 'connection.php';
  $xml = "&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;";
  $root_element = $config['users']; 
  $xml .= "&lt;$root_element&gt;";
  
  if ($result = $mysqli-&gt;query("SELECT * FROM users", MYSQLI_USE_RESULT)) {
                   while($row = $result-&gt;fetch_assoc())
                   { 
                   $xml .= "&lt;".$config['users']."&gt;";
                  //loop through each key,value pair in row
                   foreach($result_array as $key =&gt; $value)
                    {
                     //$key holds the table column name
                     $xml .= "&lt;$key&gt;";
                    //embed the SQL data in a CDATA element to avoid XML entity issues
                    $xml .= "&lt;![CDATA[$value]]&gt;";
                    //and close the element
                    $xml .= "&lt;/$key&gt;";
            }
        $xml.="&lt;/".$config['users']."&gt;";
      echo $xml;
     }
  
  }
  
  ?&gt;
  </code></pre>