I have a database which has multiple tables. I want all the table names to be displayed in a drop down html menu. I have a php function which I call on my html document.
function namealbums()
{
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
$query = mysql_query("
USE photos
GO
SELECT *
FROM sys.Tables
GO");
echo '<select name="dropdown">';
while ($row = mysql_fetch_array($query)) {
echo '<option value="'.$row.'">'.$row.'</option>';
}
echo '</select>';
}
?>
This is my HTML form which calls the function.
<table width="300px" align="center" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td cellpadding="100">
<?php echo namealbums();?>
</td>
</tr>
</table>
All i get is a drop down menu with no results in it. Just empty.