Wednesday 15 May 2013

php - mysqli prep statement error (bind_param) -


This is a hoax, though it has never been answered. So I am telling my story!

  & lt; Php include ("connect.php"); $ Keys = $ _GET ['id']; Mysqli_real_escape_string ($ db, $ keys); If (! ($ _ POST)) {$ query = $ db- & gt; Prepare the copy (Set the Copy Copy (First name, last name, gender, dub, email, street advertisement, phone number, city, state, country, zip, eye color, hair color, height, weight, chest, waist, Hips, dress, shape, shoe size) value (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,? ,?) Where PK =? "); $ Query-> Bind_param ('sssssssssssssssssssss', $ _ post [' firstName '], $ _ post [' lastname]], $ _ post ['gender'], $ _ post ['birth date'], $ _ post ['email' ], $ _ Post ['streetAddress'], $ _ post ['PhoneNumber'], $ _ post ['city'], $ _ post ['state'], $ _ post ['country'], $ _ post ['Zip'], $ _POST ['Icler'], $ _ post ['haircolor'], $ _ post ['height'], $ _ post ['weight'], $ _ post ['chest'], $ _ Post ['waist'], $ _ post ['hips'], $ _ post ['dressSize'], $ _ post ['shoeSize'], $ keyz); $ Query-> Executed (); $ Db- & gt; near (); Print_r ($ _ POST ['first name']. "". $ $ _POST ['last name']. "Has been updated."); } $ Query = "Select * Talent WHERE pk =". $ Keyz; If (! $ Result = $ db-> Query ($ query)) {Due ('There was an error running the query ['. $ Db-> Error. ']'); } While ($ line = $ result-> fetch_assoc ())? & Gt; . . .  
  $ db = new mysqli ('localhost', 'root', '', '[password]'); If ($ db-> connect_errno> 0) {die ('Unable to connect to database ['. $ Db-> Connect_apper. ']'); }   

And I get an error:

Critical error: Call memberindependent function bind_param () on a non-object: \ program files (X86) \ EasyPHP-DevServer-13.1VC9 \ data \ localweb \ FuseTalent \ editTalent.php on line 80

I have tried that danzan suggested in the second question and var_dump the $ query, but it returns all bool (false) .

What am I doing wrong? I have copied / pasted / tweaked code from any other working page.

goes wrong if something goes wrong {FALSE} -> Bind Parm (...); , which will explain the error message to a member function ... on a non-object . Add more error handling to your script

  $ query = $ db- & gt; Prepare ("Set Up Copy Copy ..."); If (! $ Query) {// something went wrong $$ db-> errno and $ db- & gt; See error in error should be http://docs.php.net/manual/en/MySqli.error.php ...}   

Also on MySQL Keep an eye on this

  update copy SET firstname =?, LastName =?, ... ou ...    

No comments:

Post a Comment