PHP代码:
$data= $db->prepare("select * from user");
$data->execute();
if($data -> rowCount()) {
echo "<table border='1'> ";
foreach ($data as $row) {
echo "<tr><td>".$row["name"]."</td><td>"
.$row["lastname"]."</td><td>"
.$row["phone"]."</td><td>"
.$row["officephone"]."</td><td>"
.$row["homephone"]."</td><td>"
.$row["GrupNo"]."</td><td>"."</td></tr>";
}
}
答案 0 :(得分:0)
您需要添加$result = $data->fetchAll(PDO::FETCH_OBJ);