The following is my code to get the results from mysql query.
Can anyone tell me...where to place the code for getting a table for two columns in the below code?

Please help me

function returnResultsInColumns( $mysqlResult )
{
$queryResults = NULL;
if( mysql_num_rows($mysqlResult) > 0 )
{
while($resultRow = mysql_fetch_array($mysqlResult))
{
for ($intPos = 0; $intPos < mysql_num_fields($mysqlResult); $intPos++)
{
$fieldName = mysql_field_name($mysqlResult, $intPos);
$currentArrayPos = ( isset( $queryResults[$fieldName] ) ? count( $queryResults[$fieldName] ) : 0);
$queryResults[$fieldName][$currentArrayPos] = $resultRow[$fieldName];
}
}
$htmlTable = "<table>";
foreach( $queryResults as $field => $results )
{
$htmlTable.= "<tr>";
$htmlTable.= "<td>" . $field . "</td><td>" . implode( ", ", $results ) . "</td>";
$htmlTable.= "</tr>";
}
$htmlTable.= "</table>";
return $htmlTable;

}
else
{
return "The query returned no results.";
}
}
// Pass the result of the MySQL query into the function.

$tableLayout = returnResultsInColumns($result);
echo $tableLayout;