$db = new PDO('mysql:host=localhost;dbname=dbname;charset=utf8', 'username', 'password');
try
{
//Prepare and execute an insert into DB
$st = $db->prepare("INSERT INTO users(login,pass,email,county) VALUES(:username,:password,:email,:county)");
$st->execute(array(':username' => $_POST['username'], ':password' => $_POST['password1'], ':email' => $_POST['email'], ':county' => $_POST['county']));
echo 'Success';
}
catch (PDOException $e)
{
echo $e->getMessage();
}
Hi, I am not completely familiar with pdo but I thought I would add a few error exceptions, except I won't actually display the error normally as I don't want everyone to know my schema. In this case I changed my working code to a non working code by changing "...,county)" to "....,count)" which obviously did not insert into the database at all but still shown "Success" and no error.
Please help :(