The database is fine but i can’t figure why $ROW cannot be recognized as NULL.
I have this code:
$pdo = new PDO("mysql:host=" . $this->hostname . ";dbname=" . $this->dbname, $this->username, $this->password);
foreach($pdo->query('SELECT * FROM people WHERE name="Joshua"') as $row):
if($row['name'] != NULL):
echo "WE HAVE ONE JOSHUA";
else:
echo "WE DO NOT HAVE ANY JOSHUA";
endif;
endforeach;
When i run this script i got the: “WE HAVE ONE JOSHUA” message;
When i change name=”Joshua” in PDO->QUERY for a name that does not exist on database i do not receive the “WE DO NOT HAVE ANY JOSHUA” message;
Any hints to deal with this?
I just want to create a statement that control if the FOREACH return NULL or NOT.
Thanks in advance and sry the bad english.
how about this?