我认为一切都很好。邮件存储在数据库中,但输出为 0。我错在哪里?
class connection {
private $mail;
private $conn;
function connect() {
$this->conn = new mysqli ('**','**','**','**');
}
function control () {
$this->mail = 'aa@a.com';
$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();
谢谢你的回复。