-4
try{
    $db = new PDO('mysql:host=localhost;dbname=members', 'user', 'password');
}catch (Exception $e){
    die('Error :' . $e->getMessage());
}

$sql = 'INSERT INTO mfb_members('',FirstName,LastName,Email,Password,Bday,Bmonth,Byear) VALUES(:first_name,:last_name,:email,:password,:birth_day,:birth_month,:birth_year)';
$response = $db->prepare($sql);
$response->execute(array(
        'first_name'=>$first_name,
        'last_name'=>$last_name,
        'email'=>$email,
        'password'=>$password,
        'birth_day'=>$birth_day,
        'birth_month'=>$birth_month,
        'birth_year'=>$birth_year,
));

Hello, it's been hours i'm trying to figure out whats wrong. The problem I have is that when I type in the .php file the prepared statement, the page on my website appears blank. I just can't figure how to send the filled-in form (users need to fill in a subscription form) to my database ?

rray
  • 2,518
  • 1
  • 28
  • 38

2 Answers2

2

You are getting a blank page because the script throws an error and you do not have error reporting enabled. It's probably the query, that is wrong:

INSERT INTO mfb_members('',FirstName
                        ^^
               error in SQL statement
Fabian Schmengler
  • 24,155
  • 9
  • 79
  • 111
0

i think the erro is SQLSTATE[HY093]: Invalid parameter number, there're 8 columns and 7 values, remove the ''

rray
  • 2,518
  • 1
  • 28
  • 38