requinix Posted September 22, 2018 Share Posted September 22, 2018 Remove that if($total_row>0) stuff. Not only is it using the wrong variable, at best it's completely unnecessary. Link to comment Share on other sites More sharing options...
Barand Posted September 22, 2018 Share Posted September 22, 2018 1 hour ago, shan2batman said: if($row1['user_id_pm']==$_SESSION['id']) Another useless bit of code. Your where clause contains ... 1 hour ago, shan2batman said: and pm_notifications.user_id_pm=:sess so you either get no results or all user_id_pm values are $_SESSION['id'] Link to comment Share on other sites More sharing options...
shan2batman Posted September 22, 2018 Author Share Posted September 22, 2018 @Barand i changed the query to something below but still the problem still it is not fetching results $query="select private_message.receiver,pm_notifications.message_id,pm_notifications.user_id_pm,user.user_id,user.avatar from pm_notifications" . " inner join private_message" . " on private_message.os_id=pm_notifications.os_id_pm" . " inner join user" . " on user.user_id=pm_notifications.user_id_pm" . " where private_message.receiver=:sess_id" . " and private_message.sender=:f_uname and pm_notifications.status=:status and pm_notifications.receiver=:f_uname" . " order by pm_notifications.pm_notification_id desc" ; //var_dump($query); $status='not_seen'; $stmt_pm_f=$conn->prepare($query); $stmt_pm_f->bindValue(":f_uname", $friend_username); //$stmt_pm_f->bindValue(":f_uname1", $friend_username); //$stmt_pm_f->bindValue(":sess",$_SESSION['id']); $stmt_pm_f->bindValue(":sess_id",$_SESSION['uname']); $stmt_pm_f->bindValue(":status",$status); $stmt_pm_f->execute(); $results_pm_f=$stmt_pm_f->fetchAll(); $total_row_f=$stmt_pm_f->rowCount(); var_dump($results_pm_f); var_dump($stmt_pm_f->rowCount()); Link to comment Share on other sites More sharing options...
requinix Posted September 22, 2018 Share Posted September 22, 2018 You cannot reuse a placeholder in a query. You still need f_uname1. Did you change any other code? Link to comment Share on other sites More sharing options...
shan2batman Posted September 23, 2018 Author Share Posted September 23, 2018 @requinix thanks for the tip it works now Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.