I have been fighting with this for half an hour now and can not figure it out. i have used SET instead of values and anything else i can think of. Here's the sql Code.
The only thing i think it may be is the checking to see if the email already exists. Not sure. I am sure some one well be able to pick what ever is. Unless GroupNum is causing the issue with mysql?PHP Code:
try
{
$queryCheck = 'SELECT * FROM users WHERE email=:email';
$s = $dbconnect->prepare($queryCheck);
$s->bindValue(':email', $email);
$emailAllreadyInUse = $s->rowCount();
}
catch(PDOException $e)
{
$error = 'Error adding your account: ' . $e->getMessage();
exit();
}
if ($emailAllreadyInUse > 0)
{
echo 'That email is allready in use. Please Use a different email';
}
else {
try
{
$query = 'INSERT INTO users (
`email`,
`password`,
`nameFirst`,
`nameLast`,
`farmName`,
`joinDate`,
`groupNum`
) VALUES (
:email,
:password,
:nameFirst,
:nameLast,
:farmName,
:date,
:groupNum
)';
$s = $dbconnect->prepare($sql);
// Bind the Values
$values = array('email' => $email, 'password' => $password, 'nameFirst' => $nameFirst, 'nameLast' => $nameLast, 'farmName' => $farmName, 'date' => $date, 'groupNum' => $groupNum);
$s->execute($values);
}
catch(PDOException $e)
{
echo '<p class=\"DB_Error\">There was an error adding your account please try again latter</p>';
}
echo '<p class=\"username\">You can now log in with the email '.$email.' and your chosen password';
}

