Doesn't work.
Desired output:
tables and their columns from a MySQL database. Assume the link is
already established. The tables are being output already, and an empty
string where the column names should be.
Code:
global $DB;
open_cell();
$tables = mysql_list_tabl es($DB);
for ($i = 0; $i < mysql_num_rows( $tables); $i++) {
$tablename = mysql_tablename ($tables, $i);
echo "Table: ", $tablename, "<br><br>\n ";
$fieldlist = mysql_field_nam e($DB, $tablename);
for ($a = 0; $a < mysql_num_field s($fieldlist); $a++) {
$fieldname = mysql_fetch_fie ld($fieldlist, $a);
$field_output = mysql_fetch_row ($fieldname, $a);
echo $fieldname . " <-> "; // <- this is going to look unfinished
}
echo "<br><br>\n ";
}
I have a foreboding feeling that my approach is what is B0rK3n. I also
tried mysql_fetch_arr ay and imploding it for a delimited list. No dice.
My query is broken in there somewhere and I'm just not getting it.
--
Bachelors' wives and old maids' children are always perfect.
-- Nicolas Chamfort
Desired output:
tables and their columns from a MySQL database. Assume the link is
already established. The tables are being output already, and an empty
string where the column names should be.
Code:
global $DB;
open_cell();
$tables = mysql_list_tabl es($DB);
for ($i = 0; $i < mysql_num_rows( $tables); $i++) {
$tablename = mysql_tablename ($tables, $i);
echo "Table: ", $tablename, "<br><br>\n ";
$fieldlist = mysql_field_nam e($DB, $tablename);
for ($a = 0; $a < mysql_num_field s($fieldlist); $a++) {
$fieldname = mysql_fetch_fie ld($fieldlist, $a);
$field_output = mysql_fetch_row ($fieldname, $a);
echo $fieldname . " <-> "; // <- this is going to look unfinished
}
echo "<br><br>\n ";
}
I have a foreboding feeling that my approach is what is B0rK3n. I also
tried mysql_fetch_arr ay and imploding it for a delimited list. No dice.
My query is broken in there somewhere and I'm just not getting it.
--
Bachelors' wives and old maids' children are always perfect.
-- Nicolas Chamfort
Comment