Jump to content

Recommended Posts


my code not working it like the $sql->bindParam all fail please help


$user_paypal_email=$_POST['user_paypal_email'];
$user_skype_name=$_POST['user_skype_name'];
$user_package_type=$_POST['user_package_type'];

if( ($user_date_added) && ($user_id) && ($user_paypal_email) && ($user_skype_name) && ($user_package_type) ){

$conn = new PDO("mysql:host=$dbhost; dbname=$dbname", $dbusername, $dbpassword);

$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

$sql = ("INSERT INTO user_add (`user_id`, `user_paypal_email` , `user_skype_name` , `user_package_type` , `user_date_added` )
VALUES (:user_id, :user_paypal_email, :user_skype_name, :user_package_type, :user_date_added )");

$sql->bindParam(':user_id', $user_id, PDO::PARAM_STR);
$sql->bindParam(':user_paypal_email', $user_paypal_email, PDO::PARAM_STR);
$sql->bindParam(':user_skype_name', $user_skype_name, PDO::PARAM_STR);
$sql->bindParam(':user_package_type', $user_package_type, PDO::PARAM_STR);
$sql->bindParam(':user_date_added', $user_date_added, PDO::PARAM_STR);
$sql->exec($sql);


 

Edited by redarrow
Link to comment
https://forums.phpfreaks.com/topic/303484-struggling-with-pdo-and-php/
Share on other sites

my code not working...please help

 

That is the WORST way to ask for help. You have over 7 thousand posts and don't know how make a proper request for help?

 

WHAT isn't working? What is the error message you get? What is the result? Is the missing brace actually in your code and you didn't post it here?

Edited by benanamen
  • Like 1

I think “all fail” is a pretty accurate description of the code. :happy-04:

 

redarrow: Take a deep breath, try to concentrate for a few minutes and then do this step by step. You need to

  • Create a prepared statement with $conn->prepare()
  • Bind values to that prepared statement
  • Execute the prepared statement
  • Like 1
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.