public function saveData(){
$query = "
INSERT INTO chat_user_table
(user_name, user_email, user_password, user_profile,
user_status, user_created_on, user_verification_code)
VALUES
(:user_name, :user_email, :user_password, :user_profile,
:user_status, :user_created_on, :user_verification_code)
";
$params = [
':user_name'=> $this->user_name,
':user_email'=> $this->user_email,
':user_password'=> $this->user_password,
':user_profile'=> $this->user_profile,
':user_status'=> $this->user_status,
':user_created_on'=> $this->user_created_on,
':user_verification_code'=> $this->user_verification_code
];
$statement = $this->connect->prepare($query);
foreach ($params as $key => $value) {
$statement->bindParam($key, $value);
}
if($statement->execute())
{
return true;
}
else
{
return false;
}
if(isset($_POST['mess_send']) && $_POST['message']!='' && isset($_COOKIE['log'])){
$commentator = trim(filter_var($_COOKIE['log'], FILTER_SANITIZE_STRING));
$mess = trim(filter_var($_POST['message'], FILTER_SANITIZE_STRING));
$sql = 'INSERT INTO comms(username, message, article_id) VALUES(?,?,?)';
$query = $pdo->prepare($sql);
$query->execute([$commentator, $mess, $_GET['id']]);
unset($_POST['message']);
}