Why is it that only the first sets of data are displayed and not the entire data?
Here is my code..(Sorry, still new to OOP)
include 'crud.php';
$db_host = "localhost";
$db_name = "crud";
$db_username = "root";
$db_password = "";
$conn = new PDO("mysql:host=$db_host;dbname=$db_name", $db_username, $db_password);
$select = new Crud($conn);
$select->crud_select();
crud.php
class Crud
{
private $conn;
public function __construct($conn){
$this->conn = $conn;
}
public function crud_insert($lname, $fname, $address, $age){
}
public function crud_select(){
$result = $this->conn->prepare("SELECT * FROM personal_info");
$result->execute();
$count = $result->rowCount();
if($count == 0){
$no_files = "No file(s) found!";
echo $no_files;
}
else{
$row = $result->fetch();
echo $row['last_name'] . "<br/>";
echo $row['first_name'] . "<br/>";
echo $row['address'] . "<br/>";
echo $row['age'] . "<br/>";
}
}
}
if i'm trying fetchAll()
it's not displaying anything.