2013-11-01 62 views
-1

我認爲一切都很好。郵件存儲在數據庫中,但輸出爲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(); 

謝謝你的回覆。

+0

@JoachimIsaksson'mysqli_stmt'也有它,可以在'store_result'之後找到。 –

回答

1

execute是一個方法:

$stmt->execute(); 
+0

啊!謝謝。 – Emre

0

當一個程序處理,你應該總是有錯誤報告上。
在開發PC上,讓它們正確顯示在瀏覽器中是正確的,而在生產服務器上,您必須檢查它們的錯誤日誌。

只是因爲

Notice: Undefined property: mysqli_stmt::$execute in ... 

錯誤信息是清晰和明確的。