Good Evening All,I'm very new to PDO prepared statements and need some guidance/gentle nudges. I've created the following MySQL stored procedure:\[code\]-- ---------------------------------------------------------------------------------- Routine DDL-- --------------------------------------------------------------------------------DELIMITER $$CREATE DEFINER=`root`@`%` PROCEDURE `RegInsert`(IN p_regid int,IN p_username VARCHAR(45),IN p_password VARCHAR(45),IN p_confpassword VARCHAR(45),IN p_status INT(1),IN p_salutation VARCHAR(45),IN p_firstname VARCHAR(45),IN p_lastname VARCHAR(45),IN p_jobtitle VARCHAR(45),IN p_telephone VARCHAR(45),IN p_companyname VARCHAR(45),IN p_industry VARCHAR(45),IN p_address VARCHAR(45),IN p_city VARCHAR(45),IN p_state VARCHAR(45),IN p_country VARCHAR(45),IN p_postalcode VARCHAR(45),IN p_regtype VARCHAR(45),IN p_interest VARCHAR(45),IN p_hdsprovider VARCHAR(45))BEGINInsert into regdata(RegID,UserName,Password,Confpassword,Status,Salutation,FirstName,LastName,JobTitle,Telephone,Companyname,Industry,Address,City,Country,State,PostalCode,RegType,Interests,HDSprovider)values(p_regid,p_username,p_password,p_confpassword,p_status,p_salutation,p_firstname,p_lastname,p_jobtitle,p_telephone,p_companyname,p_industry,p_address,p_city,p_country,p_state,p_postalcode,p_regtype,p_interest,p_hdsprovider);END\[/code\]In reading the documentation on PDO, I understand that the following statement is used to open the connection and the try catch block sets the parameters. That's where I'm getting confused. Here's my code block thus far:\[code\]<?phprequire once ("/home/somedir/pdo_connect.php")try{$dbh=pdo_connect.php();$stmt = $dbh->prepare("CALL RegInsert(?)");$stmt->bindParam}catch (PDOException $e) {print "Error!: " . $e->getMessage() . "<br/>";die();}?>\[/code\]Questions:
1. What is the correct syntax for associating my procedure input parameters with my PHP form variables? Is it something like:\[code\]$_Post['salutation'] = p_salutation\[/code\][*]Reginsert.php contains the above PDO statements. How do I call it from my submit button on the form?[*]Do you suggest creating a separate file and container function for the confirmation email? If so, how do I trigger that file to run after reginsert.php runs without errors?Thanks so much for helping this sleep-deprived newbie. It's much appreciated!!EDIT:Here's the revised code for reginsert.php. When I provide valid form data and press submit, a record is not inserted into the database. Can you steer me in the right direction?\[code\]<?phprequire once ("/home/mydir/pdo_connect.php")try{$dbh=pdo_connect.php();$stmt = $dbh->prepare('CALL RegInsert(?)');$stmt->bindParam('_username',$email_address,PDO:ARAM_STR,45);$stmt->bindParam('_password',$create_password,PDO:ARAM_STR,45);$stmt->bindParam('_confpassword',$confirm_password,PDO:ARAM_STR,45);$stmt->bindParam('_salutation',$salutation2,PDO:ARAM_STR,45);$stmt->bindParam('_firstname',$first_name,PDO:ARAM_STR,45); $stmt->bindParam('_lastname',$last_name,PDO:ARAM_STR,45);$stmt->bindParam('_jobtitle',$job_title,PDO:ARAM_STR,45);$stmt->bindParam('_telephone',$telephone,PDO:ARAM_STR,45);$stmt->bindParam('_companyname',$company_name,PDO:ARAM_STR,45);$stmt->bindParam('_industry',$industry,PDO:ARAM_STR,45);$stmt->bindParam('_address',$address,PDO:ARAM_STR,45); $stmt->bindParam('_city',$city,PDO:ARAM_STR,45);$stmt->bindParam('_state',$state,PDO:ARAM_STR,45);$stmt->bindParam('_country',$country,PDO:ARAM_STR,45);$stmt->bindParam('_postalcode',$postal_code,PDO:ARAM_STR,45);$stmt->bindParam('_regtype',$partner_customer_other,PDO:ARAM_STR,45);$stmt->bindParam('_interest',$interests,PDO:ARAM_STR,45);$stmt->bindParam('_hdsprovider',$provider_partner,PDO:ARAM_STR,45);$stmt->bindParam('_passwordremindquestion',$password_reminder_question,PDO:ARAM_STR,45);$stmt->bindParam('_passwordremindanswer',$password_reminder_answer,PDO:ARAM_STR,45);$stmt->execute();}catch (PDOException $e) {print "Error!: " . $e->getMessage() . "<br/>";die();}?>\[/code\]
1. What is the correct syntax for associating my procedure input parameters with my PHP form variables? Is it something like:\[code\]$_Post['salutation'] = p_salutation\[/code\][*]Reginsert.php contains the above PDO statements. How do I call it from my submit button on the form?[*]Do you suggest creating a separate file and container function for the confirmation email? If so, how do I trigger that file to run after reginsert.php runs without errors?Thanks so much for helping this sleep-deprived newbie. It's much appreciated!!EDIT:Here's the revised code for reginsert.php. When I provide valid form data and press submit, a record is not inserted into the database. Can you steer me in the right direction?\[code\]<?phprequire once ("/home/mydir/pdo_connect.php")try{$dbh=pdo_connect.php();$stmt = $dbh->prepare('CALL RegInsert(?)');$stmt->bindParam('_username',$email_address,PDO:ARAM_STR,45);$stmt->bindParam('_password',$create_password,PDO:ARAM_STR,45);$stmt->bindParam('_confpassword',$confirm_password,PDO:ARAM_STR,45);$stmt->bindParam('_salutation',$salutation2,PDO:ARAM_STR,45);$stmt->bindParam('_firstname',$first_name,PDO:ARAM_STR,45); $stmt->bindParam('_lastname',$last_name,PDO:ARAM_STR,45);$stmt->bindParam('_jobtitle',$job_title,PDO:ARAM_STR,45);$stmt->bindParam('_telephone',$telephone,PDO:ARAM_STR,45);$stmt->bindParam('_companyname',$company_name,PDO:ARAM_STR,45);$stmt->bindParam('_industry',$industry,PDO:ARAM_STR,45);$stmt->bindParam('_address',$address,PDO:ARAM_STR,45); $stmt->bindParam('_city',$city,PDO:ARAM_STR,45);$stmt->bindParam('_state',$state,PDO:ARAM_STR,45);$stmt->bindParam('_country',$country,PDO:ARAM_STR,45);$stmt->bindParam('_postalcode',$postal_code,PDO:ARAM_STR,45);$stmt->bindParam('_regtype',$partner_customer_other,PDO:ARAM_STR,45);$stmt->bindParam('_interest',$interests,PDO:ARAM_STR,45);$stmt->bindParam('_hdsprovider',$provider_partner,PDO:ARAM_STR,45);$stmt->bindParam('_passwordremindquestion',$password_reminder_question,PDO:ARAM_STR,45);$stmt->bindParam('_passwordremindanswer',$password_reminder_answer,PDO:ARAM_STR,45);$stmt->execute();}catch (PDOException $e) {print "Error!: " . $e->getMessage() . "<br/>";die();}?>\[/code\]