php - Displaying the name of a users id -


i have table set-up friends using 1 user's id , user's id , trying take logged in user's id , search every other user's id paired friends grab id's , match id in table called s_users , display names of users in table specific user logged in. assistance?

this code showing logged in , grabbing id (working).

<?   require("includes/db.php"); session_start(); $member_id = $_session['member_id'];  //employee login database    $result = mysql_query("select * s_user id='$member_id'") or die(mysql_error()); $row = mysql_fetch_assoc($result); $name = $row['user_nicename']; echo "'$name'"; ?> 

this code have displaying information needed , have no idea i'd begin it:

<?php  $query = 'select * s_user inner join s_friends b on a.id = b.user_id'; $statusresult = mysql_query($query); while($row = mysql_fetch_array($statusresult)) {   $postdate = strtotime($row['status_time']);   echo '<table cellpadding="2" cellspacing="0" border="1" width="100%">         <fieldset>             <legend>           '.$row['user_nicename'].'             </legend></td>             <hr>     </table>         </fieldset>     <hr />'; }  ?> 

select * s_user inner join s_friends b on a.id = b.user_id , a.id = $_session['memberid']; 

please make sure use prevention tactics mysql injection , upgrade query mysqli


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -