I have a table in the database called emails
, with the following fields:
id
subject
body
e status (0, para não enviado, ou 1, para enviado).
I was doing a query to retrieve only the rows that have status 1, my SQL query was:
"SELECT * FROM emails WHERE status = '1'"
The problem is ... Doing through parameterized query,
$status = "1";
$stmt = $db->prepare("SELECT * FROM emails WHERE status = :status");
$stmt->bindParam(":status", $status, PDO::PARAM_STR);
$stmt->execute();
In the end I want it to return all emails that have this status equal to 1, not just the first occurrence, nor the number of rows affected by query , so far I have not been able to, because or only returns the first occurrence using $stmt->fetch();
or else the number of affected rows using $stmt->rowCount();