I'm relitively new to PHP, but i'm currently working on a little database project, and i can't figure out how to do the following:
I want a listbox in one of my forms to display the names of the tables inside a mySQL database, as it's list items/values.
the way I tried was to use the code
<?php
mysql_connect("localhost", "mysql_user", "mysql_password");
$result = mysql_list_tables("mydb");
for ($i = 0; $i < mysql_num_rows($result); $i++) {
echo mysql_tablename($result, $i), "\n";
}
mysql_free_result($result);
?>
in between the <option></option> tags of my html form listbox, but that displays the tables names as one line and consiquently displays them as one item in the listbox, the problem I have is that I want each different table name to be a different option of the listbox, is there a way to do this that I am overlooking?
I hope you guys can help!
Many Thanks
Dan
Coatsy35@lycos.co.uk