I'd just like to enquire if the coding to read all records in a database has changed?
Using PDO and php version 7, I'm now unable to read from a database part from the first record.
Code: Select all
try {
$conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
// set the PDO error mode to exception
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$results = $conn->query('SELECT * FROM members');
while ($row = $results->fetch()) {
// Do Something Here.
}
}catch(PDOException $e ){
echo "<br>" . $e->getMessage();
}
With the above code, I'm in the process of re-writing the login screen.
Any ideas how to overcome this?
Thanks.