PDA

View Full Version : PHP insert prepare error



lung
27 Oct 2010, 04:00 AM
$stmt = $conn->prepare("INSERT INTO tbljobseeker(EMail_Address,User_Password,FirstName,LastName,Gender,Date_of_birth,Register_Date,User_ Block,Lastvisit_Date,Activate_Code) VALUES(?,?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");

$stmt->bind_param($EMail_Address, $sha1pass, $FirstName, $LastName, $Gender, $birth_date,$birth_date,$zero,$birth_date,$activate);

$stmt->execute();


and i get error :Fatal error: Call to a member function bind_param() on a non-object in

i have 11 parameter(?) but i send only 10 value because (i think)have 1 auto number field.
and if have 10 parameter(?) i get this error :Number of elements in type definition string doesn't match number of bind variables in

kwikweb
28 Oct 2010, 10:45 PM
I have two things to answer to you.
First off, the error that you posted usually occurs when the $stmt object was not initallized properly. Possibly because the connection was not properly made or the prepare statement did not function correctly.

Secondly, you have 11 question marks in your INSERT statement and only 10 variables. If the first one is actually an autonumber field then you should not put a ? into that field, you should put empty simple quotes such as ''.

That will most likely fix your problem