Search the Community
Showing results for tags 'tables'.
-
Hi, I'm trying to build a dropdown in a form with, as options, the names of the tables of one database. How can I do? This is my script, it doesn't work: there isn't the dropdown... <form method="get"> <?php // database connection include('connect-db.php'); $result = mysql_query("SHOW TABLES") or die(mysql_error()); ?> <select name="select1"> <?php while ($line = mysql_fetch_array($result)) { ?> // The database I choose is "members", as can you see in the code below <option value="<?php echo $line['Tables_in_members'];?>"> <?php echo $line['Tables_in_members'];?> </option> <?php } ?> </select> <input type="submit" class="btn waves-effect waves-light" value="SEND"> </form> connect-db.php <?php /* CONNECT-DB.PHP Allow PHP to connect to the database */ // Database variables (I'm trying on XAMPP) $server = 'localhost'; $user = 'root'; $pass = ''; $db = 'members'; // Database connection $connection = mysql_connect($server, $user, $pass) or die ("Impossible connecting to the server ... \n" . mysql_error ()); mysql_select_db($db) or die ("Impossible connecting to the database ... \n" . mysql_error ()); ?> Thanks
-
DELETED
- 7 replies
-
- mysql
- permissions
-
(and 1 more)
Tagged with: