So I have a simple question about MySQL, trying to show a table. And this works,
function show1DbTable($tablename,$connection) {
$qs = "SELECT * from $tablename";
$q = mysql_query($qs, $connection) or die (mysql_error());
echo "<table border =1>";
while($rArray = mysql_fetch_array($q,MYSQL_ASSOC)) {
echo"<tr>\n";
while (list($k,$i) = each($rArray)) {
echo"<th>$k</th>";
}
echo"\n</tr>\n";
}
$q = mysql_query($qs, $connection) or die (mysql_error());
while($rArray = mysql_fetch_array($q,MYSQL_ASSOC)) {
echo"<tr>\n";
while (list($k,$i) = each($rArray)) {
echo"<td>$i</td>\n";
}
echo"\n</tr>\n";
}
echo"</table>";
}
But this doesn't. It just shows the field names.
function show1DbTable($tablename,$connection) {
$qs = "SELECT * from $tablename";
$q = mysql_query($qs, $connection) or die (mysql_error());
echo "<table border =1>";
while($rArray = mysql_fetch_array($q,MYSQL_ASSOC)) {
echo"<tr>\n";
while (list($k,$i) = each($rArray)) {
echo"<th>$k</th>";
}
echo"\n</tr>\n";
echo"<tr>\n";
while (list($k,$i) = each($rArray)) {
echo"<td>$i</td>\n";
}
}
echo"\n</tr>\n";
echo"</table>";
}
Any help is appreciated, just trying to figure out the why..
Tj