PHP - Displaying MySQL Column Names and Values via PHP

$result = mysql_query($sql);

if ($result)
{
        $total_row = mysql_num_rows($result);
}

if ($total_row > 0)
{
        while ($tableRow = mysql_fetch_assoc($result)) {
               $result_body.= "<item>";
               foreach ($tableRow as $column => $value) {
                    $result_body.= "<{$column}><![CDATA[{$value}]]></{$column}>";
               }
               $result_body.= "</item>";
        }
}

Popular posts from this blog

SAP CPI - Loop Process Call with SuccessFactor (oData V2)

Setting IntelliJ IDEA to run Groovy Script

C# - BASE64 to Image