So the following will echo out your sql table in xml format. Just a little something I made in my free time.
PHP Code:
<?php
/* MySQL Login Structure*/
$Host = "";
$DB_Name = "";
$DB_Username = "";
$DB_Password = "";
/*MySQL Table Info/Structure*/
$DB_Table_Name = "";
$Column_0 = "";
$Column_1 = "";
$Column_2 = "";
$Column_3 = "";
$Column_4 = "";
$Column_5 = "";
/*Performs and selects the database the login to*/
$Connection = mysql_connect($Host, $DB_Username, $DB_Password) or die("Contact Manager failed to establish a connection to the MySQL database");
mysql_select_db($DB_Name,$Connection) or die("Contact Manager failed to select the MySQL Database");
/*Performs the MySQL Query to display the Contact list*/
$Query = mysql_query("SELECT * FROM $DB_Table_Name");
echo '<?xml version="1.0"?>
<Root>';
while($Rows = mysql_fetch_array($Query))
{
echo '<Contact>';
echo '<ID>' . $Rows[$Column0] . '</ID>';
echo '<Username>' . $Rows[$Column1] . '</Username>';
echo '<Gamertag>' . $Rows[$Column2] . '</Gamertag>';
echo '<Name>' . $Rows[$Column3] . '</Name>';
echo '<Aim>' . $Rows[$Column4] . '</Aim>';
echo '<Msn>' . $Rows[$Column5] . '</Msn>';
echo '</Contact>';
}
echo '</Root>';
mysql_close($Connection);
?>
For displaying the code in a table:
PHP Code:
/* MySQL Login Structure*/
$Host = "";
$DB_Name = "";
$DB_Username = "";
$DB_Password = "";
/*MySQL Table Info/Structure*/
$DB_Table_Name = "";
$Column_0 = "";
$Column_1 = "";
$Column_2 = "";
$Column_3 = "";
$Column_4 = "";
$Column_5 = "";
/*Performs and selects the database the login to*/
$Connection = mysql_connect($Host, $DB_Username, $DB_Password) or die("Contact Manager failed to establish a connection to the MySQL database");
mysql_select_db($DB_Name,$Connection) or die("Contact Manager failed to select the MySQL Database");
/*Performs the MySQL Query to display the Contacts in a table*/
$Query = mysql_query("SELECT * FROM $DB_Table_Name") or die("Contact Manager could not process the MySQL Query");
echo "<table border='1'>
<tr>
<th>ID</th>
<th>Username</th>
<th>Gamer-Tag</th>
<th>First Name</th>
<th>Aim</th>
<th>Msn</th>
</tr>";
while($Rows = mysql_fetch_array($Query))
{
echo "<tr>";
echo "<td>" . $Rows['Column_0'] . "</td>";
echo "<td>" . $Rows['Column_1'] . "</td>";
echo "<td>" . $Rows['Column_2'] . "</td>";
echo "<td>" . $Rows['Column_3'] . "</td>";
echo "<td>" . $Rows['Column_4'] . "</td>";
echo "<td>" . $Rows['Column_5'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysql_close($Connection);
?>