Afficher un message
Vieux 17/02/2008, 12h44   #1
Gilles Ganault
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut [PDO] Setting value to "nbsp;" if empty?

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.
  Réponse avec citation
 
Page generated in 0,05053 seconds with 9 queries