bindParam OR bindValue

bindParam OR bindValue

am 28.12.2010 13:15:02 von ron.piggott

------=_NextPart_000_0018_01CBA65E.F1A26700
Content-Type: text/plain;
charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

The INSERT INTO query successfully executes EXACTLY as it is. The =
bindâ€=99s arenâ€=99t working. :{Variable name] is being saved =
to the database. What do I need to change? I am not understanding this =
yet. Ron


$dsh =3D 'mysql:host=3Dlocalhost;dbname=3D'.$database2;
$dbh =3D new PDO($dsh, $username, $password);

$stmt =3D $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` =3D ':validated', `pass` =3D =
':validate_password', `account_suspended` =3D ':account_suspended', =
`account_closed` =3D ':account_closed', `last_activity` =3D =
':last_activity', `registration_ip_address` =3D =
':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
â€=9CEncouragement from Godâ€=99s Wordâ€=9D
http://www.TheVerseOfTheDay.info

------=_NextPart_000_0018_01CBA65E.F1A26700--

Re: bindParam OR bindValue

am 28.12.2010 13:32:59 von Artur Ejsmont

i am not 100% sure but should you not remove ' from around the
variables to have (NULL, :f1, :l1 etc? prepared statements take care
of escaping and quoting.

http://www.php.net/manual/en/pdo.prepare.php

does it help?

art

--
Visit me at:
http://artur.ejsmont.org/blog/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php