Reputation: 447
<?php
$busca = $pdo->prepare("SELECT * FROM `usuarios` WHERE `TIPO` = 2 AND `ESTADO` = :s ORDER BY `nESTRELAS` DESC, `NOME` ASC;");
$busca->bindValue(":s", 10);
$busca->execute();
$linha = $busca->fetchAll(PDO::FETCH_OBJ);
foreach($linha as $listar) {
echo "<li><a href='perfil.php' title='aqui'>$listar-NOME</a></li>";
}
?>
I don't understand because i recieve "could not be converted to string"
Upvotes: 0
Views: 1273
Reputation: 1067
before foreach just add this echo "<pre>"; print_r($linha);
if you are getting a array then get as like that $linha['NOME'];
if you are getting a object then use like that $linha->NOME;
please try this....
Upvotes: 0