Hi I am trying to query a database using pdo in php to return all of the information in my database, I am connecting properly to the database however when I try to return all of the database information and print it I get this result returned from my function >
PDOStatement Object ( [queryString] => SELECT * FROM users )
I would like for the function to return the entire database information. Here is my code, your help would be greatly appreciated, thank you.
public function resetpassword()
{
try
{
$conn = new PDO( DB_DSN, DB_USERNAME, DB_PASSWORD );
$conn->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
$sql = 'SELECT * FROM users';
$result = $conn->query($sql);
return $result;
$conn = null;
}
catch(PDOException $e)
{
return 'Database Error';
}
}
here is the code I use to print the results from that function:
print_r ($usr->resetpassword());