I need to break an if statement somehow. Here is the code
public function userData($data) {
//checks if user is in the database
if (self::checkUserExist($data)==false) {
$userInfo = array();
$userInfo['id'] = (isset($data->id)) ? $data->id : break;
$userInfo['email'] = (isset($data->email)) ? $data->email : break;
$this->conn->insert($userInfo, $Table); // inserts data!
}
}
The break doesn't work here. I need to return some kind of error. I could say that the input data is invalid or something, the main point for this is to avoid data insertion in database if the data is invalid.