bindParam OR bindValue
| From: | Ron Piggott | Date: | Tue, 28 Dec 2010 12:15:02 +0000 |
| Subject: | bindParam OR bindValue | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-47571@lists.php.net to get a copy of this message | ||
The INSERT INTO query successfully executes EXACTLY as it is. The bind’s aren’t working.
:{Variable name] is being saved to the database. What do I need to change? I am not understanding
this yet. Ron
$dsh = 'mysql:host=localhost;dbname='.$database2;
$dbh = new PDO($dsh, $username, $password);
$stmt = $dbh->prepare("INSERT INTO
$database2.member (
record , first_name , last_name , address_1 ,
address_2 , address_3 , address_4 , address_5 ,
email , prayer_community_alias , birth_month ,
birth_day , pass , validated , last_login ,
last_activity , birthday_records , greeting_reference ,
registration_ip_address, account_created , account_suspended
, account_closed , referral_source ,
friends_of_ministry_package , security_question_1 ,
security_answer_1 , security_question_2 , security_answer_2 ,
security_question_3 , security_answer_3 ) VALUES ( NULL , ':f1',
':l1', '', '', '', '', '',
':e1', '', ':birth_month', ':birth_day',
':validate_password', ':validated', ':last_login',
':last_activity', ':birthday_records', ':greeting_reference',
':registration_ip_address', ':account_created', ':account_suspended',
':account_closed', ':referral_source', ':friends_of_ministry_package',
':security_question_1', '', ':security_question_2', '',
':security_question_3', '' ) ON DUPLICATE KEY UPDATE validated =
':validated', pass = ':validate_password',
account_suspended = ':account_suspended', account_closed =
':account_closed', last_activity = ':last_activity',
registration_ip_address = ':registration_ip_address';");
$stmt->bindParam(':f1', $f1);
$stmt->bindParam(':l1', $l1);
$stmt->bindParam(':e1', $e1);
$stmt->bindValue(':birth_month', '0');
$stmt->bindValue(':birth_day', '0');
$stmt->bindParam(':validate_password', $validate_password);
$stmt->bindValue(':validated', '5');
$stmt->bindParam(':last_login', $todays_date);
$stmt->bindParam(':last_activity', $todays_date);
$stmt->bindValue(':birthday_records', '15');
$stmt->bindValue(':security_question_1', '0');
$stmt->bindValue(':greeting_reference', '0');
$stmt->bindParam(':registration_ip_address', $registration_ip_address);
$stmt->bindParam(':account_created', $todays_date);
$stmt->bindValue(':account_suspended', '0000-00-00');
$stmt->bindValue(':account_closed', '0000-00-00');
$stmt->bindValue(':referral_source', 2);
$stmt->bindValue(':friends_of_ministry_package', '0');
$stmt->bindValue(':security_question_1', '0');
$stmt->bindValue(':security_question_2', '0');
$stmt->bindValue(':security_question_3', '0');
// insert one row
$stmt->execute();
#$stmt->close($PDO);
unset($dbh);
The Verse of the Day
“Encouragement from God’s Word”
http://www.TheVerseOfTheDay.info