If you guys could please help, im trying to switch to the new PDO but having a hard time...
Why does this code work:
include ('connect.php');
$sql = "SELECT * FROM GP_2012";
$conn = $DBH->query($sql);
foreach ($conn as $row)
{
print $row['Prenom'] . ' ' . $row['Nom'] . '<br>' .
'Type: ' . $row['Type'] . '<br>' .
'Telephone: ' . $row['Tel'] . '<br>' .
'Mail: ' . $row['Mail'] . '<br>' .
'Bateau: ' . $row['Bateau'] . '<br>' .
'<br><br>';
}
.
And not this one:
include ('connect.php');
$sql = "SELECT * FROM GP_2012 WHERE Nom LIKE Pageot";
$conn = $DBH->query($sql);
foreach ($conn as $row)
{
print $row['Prenom'] . ' ' . $row['Nom'] . '<br>' .
'Type: ' . $row['Type'] . '<br>' .
'Telephone: ' . $row['Tel'] . '<br>' .
'Mail: ' . $row['Mail'] . '<br>' .
'Bateau: ' . $row['Bateau'] . '<br>' .
'<br><br>';
}
I tried in PHPMYADMIN and those queries both work, the second one should show one result but instead i get nothing and in my error log i get: Invalid argument supplied for foreach()