Hello
Some of the columns are empty, and must be turned into "nbsp;" so
that an empty cell is shown when displayed in HTML.
This code, however, doesn't work (meaning: I get an empty line instead
of "nbsp;"), but I don't know how else to loop through each column in
the current row:
========
$sql = "SELECT * FROM phones";
foreach($dbh->query($sql) as $row) {
foreach($row as $key =$val) {
if(!$val)
$val="nbsp;";
}
print $row['phones_name'] . "<p>";
}
========
Any idea why?
Thank you.
Some of the columns are empty, and must be turned into "nbsp;" so
that an empty cell is shown when displayed in HTML.
This code, however, doesn't work (meaning: I get an empty line instead
of "nbsp;"), but I don't know how else to loop through each column in
the current row:
========
$sql = "SELECT * FROM phones";
foreach($dbh->query($sql) as $row) {
foreach($row as $key =$val) {
if(!$val)
$val="nbsp;";
}
print $row['phones_name'] . "<p>";
}
========
Any idea why?
Thank you.
Comment