Hey Guys,
I haven't touched PHP in awhile so I am kinda rusty. I made a validation method within my new request invite class and need some help. I took out all the other code that works so we can focus on checking if email exists. I am trying to check my db table for any matching emails and if there are I put an error message into the $errors array. I have another method that checks if $errors is true and if so display errors within array. Well so far even if the email doesn't exist I get my "Whoa there! You already requested an invite!" error. What am I doing wrong? Any help would be greatly appreciated : )
PS: basic example so may look bare
public function isEmailAvailable(){
$query = "SELECT * FROM my_table WHERE email = '$this->email' LIMIT 1";
$result = mysql_query($query);
if (mysql_num_rows($result) > 0){
$this->errors[] = 'Whoa there! You already requested an invite!';
}
return count($this->errors)? 0 : 1;
}