2017-04-16 34 views
1

網站\ adduser.php可能是什麼問題?致命錯誤:調用一個成員函數布爾用C的execute(): XAMPP htdocs中上線42

function db(){ 
     $con= new mysqli('localhost' , 'root','','signupsystem') or die("fail". mysqli_connect_error()); 

     $queryb="Insert into adduser(name,fathername,gender,address,cnic,contactnumber,email,password) values($this->name,$this->fathername, 
       $this->gender,$this->address,$this->cinic_no,$this->contact_n0, $this->email , $this->password)"; 

     $result = $con->query($queryb); 
    if (!$result) { 
     die($con->error); 
    } 
     $stmt = $con->prepare($queryb); 

       if($stmt === "false") 
       { 
        trigger_error('Wrong Sql:' . $queryb . ' Error ' . $this->con->error, E_USER_ERROR); 
       } 
           $stmt->execute(); 
       $af = $stmt->affected_rows; 
     $con->close(); 
     return $af; 

    } 
+0

用'FALSE'比較,而不是「false」。 –

+0

變化虛假的錯誤occour 後「您的SQL語法錯誤;檢查對應於您的MariaDB的服務器版本使用附近的正確語法手冊‘6110197860375,03414216670,[email protected],)’在列2「 – Mudassar

+0

確切地說,現在看看你的SQL並修復那個錯誤。 –

回答

2

讓這2個東西正確:

$queryb="Insert into adduser(name,fathername,gender,address,cnic,contactnumber,email,password) values($this->name,$this->fathername, 
      $this->gender,$this->address,$this->cinic_no,$this->contact_n0, $this->email , $this->password)"; 

絃樂領域始終以單引號串接像"'.$this->cinic_no.'"

,並比較它像:

if($stmt === false) // not "false" 
+0

非常感謝主席先生,你的答案真的幫我很多 – Mudassar

+0

@Mudassar沒有一個是先生在這裏。聽起來很棒,它可以幫助你。 –

相關問題