Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
163 views
in Technique[技术] by (71.8m points)

PHP: Fatal error: Call to a member function bind_param() on a non-object

The error occurs on line 42:

$result->bind_param("ssssisssss", $Firma, $Partner, $Abteilung, $Strasse, $PLZ, $Ort, $Telefon, $Email, $Website, $Info );

This is the whole prepared statement:

$sql = "INSERT INTO `firmen` (`Firma`, `Ansprechpartner`, `Abteilung`, `Strasse`, `PLZ`, `Ort`, `Telefon`, `Email`, `Website`, `Zusatzinfos`) 
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";     
$result = $db->prepare( $sql ); 
$result->bind_param("ssssisssss", $Firma, $Partner, $Abteilung, $Strasse, $PLZ, $Ort, $Telefon, $Email, $Website, $Info );
$result->execute();

I can't find the mistake, I already read almost every question with the same mistake an I also compared my Code with a lot of Tutorial and it looks exactly the same...

Thanks in advance!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

...usually this occurs when you have an error in prepare statement, It might happen that you have a typo in sql prepare. to verify that. check the error with this

       $stmt = $this->db->prepare("INSERT INTO ".TB_ADMINISTRATION."(name, password, email) VALUES (?, ?, ?)"); 
       if(!$stmt)  //if there is an error, then it will be shown!. 
         { // show error                                                                                                       
          echo $this->db->error;
          } else {
           // everything is good to go !. 
         }

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...