escalador Posted May 17, 2008 Share Posted May 17, 2008 Hello! I have a page members.php . I want when someone logins on the page to show all his data. Below i have the code, it's working but it shows everybody data... How could i write the code , after login to see just your own data ? $sql = 'SELECT userid, username, city FROM user WHERE username = username'; $result = mysql_query($sql); if (!$result) { echo "Could not successfully run query ($sql) from DB: " . mysql_error(); exit; } if (mysql_num_rows($result) == 0) { echo "No rows found !"; exit; } while ($row = mysql_fetch_assoc($result)) { echo $row["userid"]; echo $row["username"]; echo $row["city"]; } mysql_free_result($result); this row WHERE username = username'; could be something like this? WHERE username = $_SESSION["username"]"; please help me thank's Link to comment https://forums.phpfreaks.com/topic/106098-please-help/ Share on other sites More sharing options...
ratcateme Posted May 17, 2008 Share Posted May 17, 2008 try this $sql = 'SELECT userid, username, city FROM user WHERE username = "'.$_SESSION["username"].'";'; Scott. Link to comment https://forums.phpfreaks.com/topic/106098-please-help/#findComment-543800 Share on other sites More sharing options...
escalador Posted May 17, 2008 Author Share Posted May 17, 2008 oo thank you verry much !!! i am looking this anser for 8 hours and it's correct ! thank's a lot Link to comment https://forums.phpfreaks.com/topic/106098-please-help/#findComment-543801 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.