Fru_Anthony Posted November 20, 2016 Share Posted November 20, 2016 <?php $user=htmlspecialchars($_POST['user']); $password=htmlspecialchars($_POST['password']); $email=htmlspecialchars($_POST['email']); //$number=htmlspecialchars($_POST['number']); $quater=htmlspecialchars($_POST['quater']); if (isset($user) && isset($password)&& isset($email ) && isset($quater )) { try{ $bdd = new PDO('mysql:host=localhost;dbname=library;charset=utf8', 'root', ''); } catch(Exception $e) { die('Erreur : '.$e->getMessage()); } eq = $bdd->prepare('INSERT INTO user (name, password, email, quater) VALUES (?, ?, ?, ?)'); $req->execute(array($user, $password, $email, $quater)); } else { echo "<p color=red >please fill all the fills above<p>"; } ?> <form Quote Link to comment https://forums.phpfreaks.com/topic/302575-having-problem-with-inserting-into-data-base/ Share on other sites More sharing options...
Jacques1 Posted November 20, 2016 Share Posted November 20, 2016 And the problem you're having is what? Quote Link to comment https://forums.phpfreaks.com/topic/302575-having-problem-with-inserting-into-data-base/#findComment-1539487 Share on other sites More sharing options...
ginerjm Posted November 20, 2016 Share Posted November 20, 2016 Assuming that you Really Do Have a Problem, try turning on PHP error checking. The messages may help you solve whatever un-described problem there is. (see my signature) Quote Link to comment https://forums.phpfreaks.com/topic/302575-having-problem-with-inserting-into-data-base/#findComment-1539493 Share on other sites More sharing options...
ginerjm Posted November 20, 2016 Share Posted November 20, 2016 Visually I see the following as probs: eq <p> Besides the use a plain text password in your database. And the lack of any error checking on your prepare line. Quote Link to comment https://forums.phpfreaks.com/topic/302575-having-problem-with-inserting-into-data-base/#findComment-1539495 Share on other sites More sharing options...
cyberRobot Posted November 21, 2016 Share Posted November 21, 2016 Try changing eq = $bdd->prepare('INSERT INTO user (name, password, email, quater) VALUES (?, ?, ?, ?)'); To this $req = $bdd->prepare('INSERT INTO user (name, password, email, quater) VALUES (?, ?, ?, ?)'); Quote Link to comment https://forums.phpfreaks.com/topic/302575-having-problem-with-inserting-into-data-base/#findComment-1539521 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.