$run_posts = mysqli_query($con, $user_posts); $posts = mysqli_num_rows($run_posts); //getting the number of unread messages $sel_msg = "select * from messages where receiver='{$user_id}' AND status='unread' ORDER by 1 DESC"; $run_msg = mysqli_query($con, $sel_msg); $count_msg = mysqli_num_rows($run_msg); echo "\n\t\t\t\t\t\t<center><img src='user/user_images/{$user_image}' width='200' height='200'/></center>\n\t\t\t\t\t\t<div id='user_mention'>\n\t\t\t\t\t\t<p><strong>Name:</strong> {$user_name}</p>\n\t\t\t\t\t\t<p><strong>Country:</strong> {$user_country}</p>\n\t\t\t\t\t\t<p><strong>Last Login:</strong> {$last_login}</p>\n\t\t\t\t\t\t<p><strong>Member Since:</strong> {$register_date}</p>\n\t\t\t\t\t\t\n\t\t\t\t\t\t<p><a href='my_messages.php'>Messages ({$count_msg})</a></p>\n\t\t\t\t\t\t<p><a href='my_posts.php'>My Posts ({$posts})</a></p>\n\t\t\t\t\t\t<p><a href='edit_profile.php'>Edit My Account</a></p>\n\t\t\t\t\t\t<p><a href='logout.php'>Logout</a></p>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t"; ?> </div> </div> <!--user timeline ends--> <!--Content timeline starts--> <div id="content_timeline"> <h2>Your Result is here:</h2> <?php GetResults(); ?> </div> <!--Content timeline ends--> </div> <!--Content area ends--> </div> <!--Container ends--> </body> </html> <?php }
function GetResult($select, $from, $where = '', $order_by = NULL) { $results = GetResults($select, $from, $where, $order_by); if (!$results) { return $results; } return GetArr($results); }
function GetResults($query, $data) { $results = array(); $queryLength = strlen($query); foreach ($data as $record) { if (substr(strtolower($record[0]), 0, $queryLength) == $query) { $result = array(); $result['name'] = $record[0]; $result['type'] = $record[1]; $result['content'] = $record[2]; $result['moreDetailsUrl'] = $record[3]; $result['style'] = $query == strtolower($record[0]) ? 'expanded' : 'normal'; $results[] = $result; } } return $results; } // Get the data and the query $data = GetData(); $query = strtolower(ltrim($_GET['query'])); // Build response $response = array(); $response['query'] = $query; $response['results'] = GetResults($query, $data); if (count($response['results']) == 1) { $response['autocompletedQuery'] = $response['results'][0]['name']; } // Output response echo "searchAsYouType.handleAjaxResponse("; echo json_encode($response); echo ");";