snallemap Posted September 23, 2010 Share Posted September 23, 2010 This is the code im using: <?php include "config.php"; if (isset($_GET['id'])) { $id = mysql_real_escape_string($_GET['id']); $sql = "SELECT email FROM gusers WHERE id = $id LIMIT 1"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { $row = mysql_fetch_assoc($result); echo "Email: " . $row['email']; } } } I am trying to get more informations than just the e-mail address, but everytime it seems to fail, i am a completly newb to php but ill try my best.... Could someone tell how this is done properly (like loading name, info, and so on from the database and showing it aswell) Quote Link to comment Share on other sites More sharing options...
snallemap Posted September 23, 2010 Author Share Posted September 23, 2010 I've tried some more and i just cant seem to make it work Please anyone? Quote Link to comment Share on other sites More sharing options...
Miss_Rebelx Posted September 23, 2010 Share Posted September 23, 2010 What is it not doing correctly? / What is it doing? What should it be doing? You don't need to put in all those if statements. Try something like this: <?php include "config.php"; if (isset($_GET['id'])) { $id = mysql_real_escape_string($_GET['id']); $sql = "SELECT email FROM gusers WHERE id = $id LIMIT 1"; $result = mysql_query($sql) or die (mysql_error()); if (mysql_num_rows($result) > 0) { $row = mysql_fetch_assoc($result); echo "Email: " . $row['email']; } } Quote Link to comment Share on other sites More sharing options...
merylvingien Posted September 23, 2010 Share Posted September 23, 2010 SELECT email FROM should be either SELECT email, nextcollumn, anothercollumn, etc FROM Or, if you want to pull all the collumns from the database: SELECT * FROM Then just echo each row as you want it: echo "Email: " . $row['email'] . "and" . $row['nextcollumn']; etc Quote Link to comment Share on other sites More sharing options...
snallemap Posted September 23, 2010 Author Share Posted September 23, 2010 Thanks alot ill try it out right away Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.