public function getSingleCommentDetails($postId, $loggedInUserId, $commentId) { $commentArray = array(); $commentArray1 = array(); $postArray = array(); $postArray1 = array(); //$dataQueryInfo = "SELECT login_id,user_name_f FROM login_t WHERE user_name_f= '$USERNAME' AND password_f='$PASSWORD'"; //$dataQueryInfo = "SELECT u.user_id,u.user_name_f,c.comment_text_f,c.comment_date,c.comment_id,n.post_id FROM user_details_t u, comments_t c,news_feeds_t n WHERE (u.user_id=c.user_id_fk) and (n.post_id=c.post_id_fk) and (c.comment_id=$commentId) order by c.comment_id desc"; $dataQueryInfo = "SELECT u.user_id,u.user_name_f,u.profile_pic_f,c.comment_text_f,c.comment_date,c.comment_id,n.post_id,n.post_description_f,n.post_image_f,n.post_date_f,n.like_count_f,n.image_width_f,n.image_height_f FROM user_details_t u, comments_t c,news_feeds_t n WHERE (u.user_id=c.user_id_fk) and (n.post_id=c.post_id_fk) and (c.post_id_fk={$postId}) order by c.comment_id desc"; $dataResultSet = mysql_query($dataQueryInfo, $GLOBALS['link']); $rm = new Response_Methods(); if (mysql_num_rows($dataResultSet) > 0) { $countComments = mysql_num_rows($dataResultSet); while ($row = mysql_fetch_array($dataResultSet)) { $username = $row['user_name_f']; $commentedUserId = $row['user_id']; $commentText = $row['comment_text_f']; $commentDate = $row['comment_date']; $commentIdRow = $row['comment_id']; $postId = $row['post_id']; $post_description = $row['post_description_f']; $post_image = $row['post_image_f']; $post_date = $row['post_date_f']; $like_count = $row['like_count_f']; $image_width = $row['image_width_f']; $image_height = $row['image_height_f']; $commentArray['commentedUserName'] = $username; $commentArray['commentedUserId'] = $commentedUserId; $commentArray['commentText'] = $rm->removeslashes($commentText); $commentArray['commentDate'] = $commentDate; $commentArray['commentId'] = $commentIdRow; $postArray['postId'] = $postId; $postArray['post_description'] = $post_description; $postArray['post_image_url'] = $post_image; $postArray['post_date'] = $post_date; $postArray['like_count'] = $like_count; $postArray['image_width'] = $image_width; $postArray['image_height'] = $image_height; if ($loggedInUserId == $commentedUserId) { $commentArray['editDeleteFlag'] = "1"; } else { $commentArray['editDeleteFlag'] = "0"; } //$getGrpDetails['commentCount']=$countComments; array_push($commentArray1, $commentArray); //array_push($postArray1,$postArray); } $postUserId = $rm->idToValue('user_id_fk', 'news_feeds_t', 'post_Id', $postId); $postUserName = $rm->idToValue('user_name_f', 'user_details_t', 'user_id', $postUserId); //getting user details $user_profile_pic = $rm->idToValue('profile_pic_f', 'user_details_t', 'user_id', $postUserId); //getting user details $loginUserDetails = array("postUserName" => $postUserName, "user_profile_pic" => $user_profile_pic); $postArray = array_merge($postArray, $loginUserDetails); $sqlChangeCommentStatus = "update comments_t set comment_status_f=0 where comment_id=" . $commentId; $updateCommentStatus = mysql_query($sqlChangeCommentStatus, $GLOBALS['link']); $finalArray = array("comment_details" => $commentArray1, "post_details" => $postArray); //print_r($getArrayList); $newData = json_encode(array($finalArray)); $newData = str_replace('\\/', '/', $newData); $newData = substr($newData, 1, strlen($newData) - 2); $newData = "{\"data\":{\"Error_Code\":\"41\",\"Error_Msg\":\"Comment List Successful\",\"result\":" . $newData . "}}"; return $newData; } else { $errorCode = "42"; $errorMsg = "No Such Comment Found."; $newData = "{\"data\":{\"Error_Code\":\"" . $errorCode . "\",\"Error_Msg\":\"" . $errorMsg . "\"}}"; //Json Format Response return $newData; //Comment Unsuccessful } }