Jump to content

Cannot use [] for reading


Far Cry

Recommended Posts

The following script just validates some form inputs, and then puts any errors inside an array.

 

I get this error: Fatal error: Cannot use [] for reading in C:\xampp\htdocs\Game\includes\validation.php on line 104

 

I've looked around, and this still does not make any sense to me.

 

public function ValidateEmail($email, $reemail){
/*
Sanatize.
User filter_var to validate.
Make sure both emails match.
Check if email already exists or not.
*/
  trim($email);
  strip_tags($email);
  mysql_real_escape_string($email);
  
  trim($reemail);
  strip_tags($reemail);
  mysql_real_escape_string($reemail);
  
if(!filter_var($email, FILTER_VALIDATE_EMAIL)){
  $this->valid = false;
  //Line 104 $this->error[] - "The E-Mail that you provided is not valid.";
} else {
  $this->valid = true;
}

if($email !== $reemail){
  $this->valid = false;
  $this->error[] = "The E-Mail's that you provided do not match.";
} else {
  $this->valid = true;
}
if(filter_var($email, FILTER_VALIDATE_EMAIL) && $email == $reemail){
  $checkmail = mysql_query("SELECT users.email, temp_users.email FROM users, temp_users WHERE email = '$email'");
  if(mysql_mum_rows($checkmail) == 1){
  // email is found, throw out error
  $this->valid = false;
  $this->error[] = "That E-Mail is already in use.";
  } else {
  $this->valid = true;
}
}
  return $this->error;
}

 

Line 104 is commented out.

 

Thanks!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.