'; /*** The SQL SELECT statement ***/ $sql = "SELECT * FROM emp1 ORDER BY fname"; /*** fetch into an PDOStatement object ***/ $stmt = $dbconn->query($sql); /*** echo number of columns ***/ //$result = $stmt->fetch(PDO::FETCH_NUM); // $result = $stmt->fetch(PDO::FETCH_ASSOC); /*** loop over the object directly ***/ while($row = $stmt->fetch(PDO::FETCH_ASSOC)) { echo $row['fname'].' '.$row['lname'].' '.$row['dob']; echo("
"); } /*** close the database connection ***/ $dbconn= null; } catch(PDOException $e) { echo $e->getMessage(); } ?>