Hey,
I’ve installed a new PW authentication script and have it all working except I can’t figure out how to send additional new paramenters to the database using bindValues and PDO.
The code executes fine, without generating errors anyway, but nothing is inserted in the DB with the new code (inserts fine in the original code).
I did var_dump(get_object_vars($query_new_user_insert)); and get these results. The first is from the original and the second, again, is with my two new values.
array(1) { ["queryString"]=> string(239) "INSERT INTO users (user_name, user_password_hash, user_email, user_activation_hash, user_registration_ip, user_registration_datetime) VALUES(:user_name, :user_password_hash, :user_email, :user_activation_hash, :user_registration_ip, now())" }
array(1) { ["queryString"]=> string(290) "INSERT INTO users (user_name, user_password_hash, user_email, user_activation_hash, user_registration_ip, wdgts_lnk_num, wdgts_ID, user_registration_datetime) VALUES(:user_name, :user_password_hash, :user_email, :user_activation_hash, :wdgts_lnk_num, :wdgts_ID, :user_registration_ip,now())" }
The first block of code below is the original that works and is minus the two new parameters I’m trying to install (i.e. wdgts_lnk_num, wdgts_ID).
The second block executes without errors but won’t get any data at all into the db
/* $query_new_user_insert = $this->db_connection->prepare('INSERT INTO users (user_name, user_password_hash, user_email, user_activation_hash, user_registration_ip, user_registration_datetime) VALUES(:user_name, :user_password_hash, :user_email, :user_activation_hash, :user_registration_ip, now())');
$query_new_user_insert->bindValue(':user_name', $user_name, PDO::PARAM_STR);
$query_new_user_insert->bindValue(':user_password_hash', $user_password_hash, PDO::PARAM_STR);
$query_new_user_insert->bindValue(':user_email', $user_email, PDO::PARAM_STR);
$query_new_user_insert->bindValue(':user_activation_hash', $user_activation_hash, PDO::PARAM_STR);
$query_new_user_insert->bindValue(':user_registration_ip', $_SERVER['REMOTE_ADDR'], PDO::PARAM_STR);
$query_new_user_insert->execute();
*/
$query_new_user_insert = $this->db_connection->prepare('INSERT INTO users (user_name, user_password_hash, user_email, user_activation_hash, user_registration_ip, wdgts_lnk_num, wdgts_ID, user_registration_datetime) VALUES(:user_name, :user_password_hash, :user_email, :user_activation_hash, :wdgts_lnk_num, :wdgts_ID, :user_registration_ip,now())');
$query_new_user_insert->bindValue(':user_name', $user_name, PDO::PARAM_STR);
$query_new_user_insert->bindValue(':user_password_hash', $user_password_hash, PDO::PARAM_STR);
$query_new_user_insert->bindValue(':user_email', $user_email, PDO::PARAM_STR);
$query_new_user_insert->bindValue(':user_activation_hash', $user_activation_hash, PDO::PARAM_STR);
$query_new_user_insert->bindValue(':user_registration_ip', $_SERVER['REMOTE_ADDR'], PDO::PARAM_STR);
$query_new_user_insert->bindValue(':wdgts_lnk_num', $wdgts_lnk_num, PDO::PARAM_INT);
$query_new_user_insert->bindValue(':wdgts_ID', $wdgts_ID, PDO::PARAM_STR);
$query_new_user_insert->execute();
The PDO PARAM types are correct as $wdgts_ID is varchar in the DB
I’ve beating this (more like it’s beating me) for hours now so any help would be appreciated.
Thanks