Здравствуйте, у меня возникла проблема с уведомлением об отправке сообщения в PHP PDO. Ниже приведен мой код для addMention sendNotification, если кто-то упомянул пользователя в своем сообщении.
public function addMention($status,$user_id, $tweet_id){
preg_match_all("/@+([a-zA-Z0-9_]+)/i", $status, $matches);
if($matches){
$result = array_values($matches[1]);
}
$sql = "SELECT * FROM users WHERE username = :mention";
foreach ($result as $trend) {
if($stmt = $this->pdo->prepare($sql)){
$stmt->execute(array(':mention' => $trend));
$data = $stmt->fetch(PDO::FETCH_OBJ);
}
}
if($data->user_id != $user_id){
Message::sendNotification($data->user_id, $user_id, $tweet_id, 'mention');
}
}
И ниже мой sendNotication функция
public function sendNotification($get_id, $user_id, $target, $type){
$this->create('notification', array('notificationFor' => $get_id, 'notificationFrom' => $user_id, 'target' => $target, 'type' => $type, 'time' => date('Y-m-d H:i:s')));