我認爲一切都很好。郵件存儲在數據庫中,但輸出爲0.我錯在哪裏?Mysqli stmt num_rows always 0
class connection {
private $mail;
private $conn;
function connect() {
$this->conn = new mysqli ('**','**','**','**');
}
function control() {
$this->mail = '[email protected]';
$checkmail = 'SELECT * FROM table WHERE email = ?';
if ($stmt = $this->conn->prepare($checkmail)) {
$stmt->bind_param('s', $this->mail);
$stmt->execute;
$stmt->store_result();
$count = $stmt->num_rows;
echo $count;
}
}
}
$a = new connection();
$a->connect();
$a->control();
謝謝你的回覆。
@JoachimIsaksson'mysqli_stmt'也有它,可以在'store_result'之後找到。 –