wie zu überprüfen, mysql NULL
Spalten mit PHP variabel?php mysql wie zu prüfen, NULL-Spalte mit PHP
meine Zeilen Tabelle (Beispiel):
1 ---- james ------ italy
2 ---- joyee ------ NULL
meine Array von Tisch holen:
$rows[0] = array('name' => 'james', 'country' => 'italy');
$rows[1] = array('name' => 'joyee', 'country' => NULL);
aber mein Problem:
, wie Sie überprüfen NULL-Array Element:
foreach($rows as $row) {
if ($row['country'] == NULL) echo "country is null"; // not working
if ($row['country'] == '') echo "country is null"; // not working
if (is_null($row['country'])) echo "country is null"; // not working
if (empty($row['country'])) echo "country is null"; // not working
// what is solution? how to check null?
}
Update (Var_dump):
'country' => null
Versuchen Sie Null in Kleinbuchstaben. –
können Sie Ihren Beitrag mit 'var_dump ($ rows [1])' 'aktualisieren? –
Mögliches Duplikat von [PHP Check für NULL] (https://stackoverflow.com/questions/1576243/php-check-for-null) –