I give me this error that i dont have seen: 'Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\sito\personalImage.php on line 17' this is my code:
try{
$conn= new PDO("mysql:host=localhost;dbname=first","root","..");
echo "connection good";
$user=$_COOKIE['log'];
$conn->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
foreach($conn->exec('SELECT cognome FROM utenti') as $row){
}
$conn=null;
}
catch(PDOException $e){
echo $e->getMessage();
}
connection to the database is good. Someone can give me an explanation