php - Message: SQLSTATE[HY093]: Invalid parameter number: parameter was not defined -
the following code producing exception @ $stmt->execute();
this new issue, have gone through other listings error , issues identified cleared here. new issue reported slim? idea else be? many thanks, has turned out 2 day problem. i'm code-blind atm.
$gender = $_post['gender']; $firstname = $_post['firstname']; $lastname = $_post['lastname']; $age = $_post['age']; $phone = $_post['phone']; $contactpreference = $_post['contactpreference']; $city = $_post['city']; $state = $_post['state']; $country = $_post['country']; $zip = $_post['zip']; $adtype = $_post['adtype']; $activity = $_post['activity']; $whendate = $_post['whendate']; $providergender = $_post['providergender']; $providerage = $_post['providerage']; $provideroffer = $_post['provideroffer']; $db = new pdo( "mysql:host=$server;dbname=$dbname;charset=utf8", $username, $password); $db->setattribute( pdo::attr_errmode, pdo::errmode_exception ); $stmt = $db->prepare( 'insert customers ( gender, firstname, lastname, age, phone, contactpreference, city, state, country, zip, adtype, activity, whendate, providergender, providerage, provideroffer ) values ( :gender, :firstname, :lastname, :age, :phone, :contactpreference, :city, :state, :country, :zip, :adtype, :activity, :whendate, :providergender, :providerage, :provideroffer );' ); $stmt->bindparam(':gender', $gender ); $stmt->bindparam(':firstname', $firstname ); $stmt->bindparam(':lastname', $lastname ); $stmt->bindparam(':age', $age ); $stmt->bindparam(':phone', $phone ); $stmt->bindparam(':contactpreference', $contactpreference ); $stmt->bindparam(':city', $city ); $stmt->bindparam(':state', $state ); $stmt->bindparam(':country', $country ); $stmt->bindparam(':zip', $zip ); $stmt->bindparam(':adtype:', $adtype ); $stmt->bindparam(':activity', $activity ); $stmt->bindparam(':whendate', $whendate ); $stmt->bindparam(':providergender', $providergender ); $stmt->bindparam(':providerage', $providerage ); $stmt->bindparam(':provideroffer', $provideroffer ); $stmt->execute();
extra :
@ $stmt->bindparam(':adtype:', $adtype );
it be
$stmt->bindparam(':adtype', $adtype );
Comments
Post a Comment