No primatiers bound

Hey there, I am running into an error that is escaping me,

Here’s the code

Warning: PDOStatement::execute() [pdostatement.execute]: SQLSTATE[HY093]: Invalid parameter number: no parameters were bound in /var/www/ageasy/processesAccount.php on line 40 line 40 is the first line in the code here.

if($res = $check->execute($vlaues['1']))
				{
					if($res->fetchColumn() < 1)
						{
							$query['2'] = 'INSERT INTO users SET
									email = :email,
									password = :password,
									dateJoined = CURDATE(),
									farmName = :farmName,
									name = :name,
									salt1 = :salt1,
									salt2 = :salt2,
									limt_results = `15`,
									level = `2`,
									reciveEmail = :recive';
							$values['2'] = array('email' => $clean->text($_POST['email']), 'password' => $clean->text($_POST['password']), 'farmname' => $clean->text($_POST['farmname']), 'name' => $clean->text($_POST['farm']), 'salt1' => $salt['2'], 'salt2' => $salt['1'], 'reciveEmail' => $_POST['reciveEmail'] );
							$insert = $pdo->prepare($query['2']);
							$insert->execute($values['2']);


							echo "Hello {$_POST['name']}, \
  your account has been created! you can login with {$_POST['email']} and your correct password";
							mail($_POST['email'],'no-reply@ageasy.ca','Your New Account!',$message,'support@ageasy.ca');								
						}

Thanks for the help! I have allready checked that $_POST[‘email’] contents a address and it does.

First line:


if($res = $check->execute($vlaues['1'])) 

check the spelling in $values

Thud!

Thanks <feels kind of stupid>

Now a different question, i have been using this example http://php.net/manual/en/pdostatement.rowcount.php (#2) and am getting this error : Call to a member function fetchColumn() on a non-object with this line ( if($res->fetchColumn() < 1) )

thanks

where does $values[1] come from?
Does it contain the prepared SQL statement?

echo it and see what it says.

values[‘1’] contains the email address for row count, it is the values that are used in the execution of the query. Could not echo it (it’s an array) had to use use var_dump and it returned array(1) { [“email”]=> string(21) “someemailhere” } , so what i was exepecting it to return

Look closely at this placeholder, I think this might be causing the problem.


reciveEmail = :recive'; 

vs your binding:


'reciveEmail' => $_POST['reciveEmail'] )

SB


reciveEmail = :reciveEmail'; 

Formatting your code would make it more readable and therefore easier to spot inconsistencies like this.


$values['2'] = array('email' => $clean->text($_POST['email'])
, 'password' => $clean->text($_POST['password'])
, 'farmname' => $clean->text($_POST['farmname'])
// and so on