Hello all and thanks for taking the time to look at my post. I don’t have a syntax error but I can’t figure out what I’m missing. Quick overview: Within the script, connect to your DBMS using the “script” identity. Select the “fleamarket” database, then obtain a listing of the tables. Use the file-creation techniques to save the results of your queries into a file named solution07.txt.
I’m now lost and trying to go over everything again (the 8th time) and I can’t seem to figure out where I went wrong. If you have any insight or advice, it would be greatly appreciated. Thank you.
[php]<?php
$connection = mysql_connect(“localhost”, “script”, " ")
or die(mysql_error());
$dbs = @mysql_select_fleamarket($connection) or die(mysql_error());
$db_list = “
- ”;
- $db_names[$db_num]”;
$tables = mysql_list_tables($db_names[$db_num]) or die(mysql_error()); $table_list = "<ul>"; $table_num = 0; while ($table_num < mysql_num_rows($tables)) { $table_names[$table_num] = mysql_tablename($tables, $table_num); $table_list .= "<li>$table_names[$table_num]"; $table_num++; } $table_list .= "</ul>"; $db_list .="$table_list"; $db_num++;
}
$db_list .= “
$db_num = 0;
while ($db_num < mysql_num_rows($dbs)) {
$db_names[$db_num] = mysql_tablename($dbs, $db_num);
$db_list .= “
$filename = “d:/wamp/www/solution07.txt”;
$newfile = fopen($filename, “w+”) or die(“Couldn’t create file.”);
fclose($newfile);
mysql_close($connection);
?>
Database and tables on localhost
<?php echo "$db_list"; ?> [/php]