I want to know about this error how can I sort out this error? Check my code, here is the function.
Here is the code that i am using: first is create function and second is error checking, how can I know about this error further please help me out, take me out from this problem.
function create(){
$this->created=date('Y-m-d H:i:s');
// insert query
$query = "INSERT INTO " . $this->table_name . "
SET
uname = :uname,
email = :email,
contact_number = :contact_number,
password = :password,
access_level = :access_level,
access_code = :access_code,
status = :status,
created = :created";
$stmt = $this->conn->prepare($query);
$this->uname=htmlspecialchars(strip_tags($this->uname));
$this->email=htmlspecialchars(strip_tags($this->email));
$this->contact_number=htmlspecialchars(strip_tags($this->contact_number));
$this->password=htmlspecialchars(strip_tags($this->password));
$this->access_level=htmlspecialchars(strip_tags($this->access_level));
$this->access_code=htmlspecialchars(strip_tags($this->access_code));
$this->status=htmlspecialchars(strip_tags($this->status));
$stmt->bindParam(':uname', $this->uname);
$stmt->bindParam(':lastname', $this->lastname);
$stmt->bindParam(':email', $this->email);
$stmt->bindParam(':contact_number', $this->contact_number);
$password_hash = password_hash($this->password, PASSWORD_BCRYPT);
$stmt->bindParam(':password', $password_hash);
$stmt->bindParam(':access_level', $this->access_level);
$stmt->bindParam(':access_code', $this->access_code);
$stmt->bindParam(':status', $this->status);
$stmt->bindParam(':created', $this->created);
// execute the query, also check if query was successful
if($stmt->execute()){
return true;
}else{
$this->showError($stmt);
return false;
}
}