1
<?php include ('pdo.php');
class crud
{
public static function select($arg){
$pdo = new pdoinit();
$result = $pdo->prepare($arg);
$result->execute();
$resultado = $result->fetch(PDO::FETCH_ASSOC);
return $resultado;
}
}
$arr = crud::select('select * from grupos');
print_r($arr);
while ($row = $arr){
echo $row['nome'];
}
$row
left where? it was not clear the problem.– rray
$Row is a var that will take the information to the while loop, var_dump($arr) will resume this = "Array ( [id_group] => 12 [id_usuario] => 7 [name] => Friends ) "
– Jean Freitas
pq u need while? by example seems not to need it.
– rray
I’m using this while to display information on a grid. <? php while ( $gridGroup = crud::select('select * from groups')){ echo "<tr>"; echo '<th Scope="Row">'. $gridGroup['id_group']. '</th>'; echo '<td>'. $gridGroup['name']. '</td>'; echo '<td>'. ' '.'</td>'; } ?>
– Jean Freitas
I think better [Edit] the question and put more details about what you want to do and what is the problem or unexpected result.
– rray