-1
what error there is in Foreach?
<?php
$banco = "mysql:dbnmae=banco;host=localhost";
$user = "root";
$senha = "";
try{
$conn= new PDO($banco,$user,$senha);
echo "<h1>conectado com sucesso</h1>";
$sql = " SELECT * FROM banco";
$linha =$conn->query($sql);
foreach($linha as $linhas){
echo $linhas['nome'];
}
}
catch (PDOException $e){
echo "<h1>Falha ao conectar</h1>";
$erro = $e->getCode();
echo $erro;
}
You wrote
dbnmae
instead ofdbname
– reisdev
you saved my life, very sheltered
– Sarah Leesy