Colourtheory Posted December 23, 2012 Share Posted December 23, 2012 So I tried to make a profile page.. it's not working out so well. Here is the profile page's source, and note: the address bar when you click the link comes out to be ?id= and even if I type the ?id=1 it still doesn't work <?phpsession_start();require_once 'db.php'; $id = $_GET['id'];$user = mysql_query("SELECT name FROM users WHERE id='$id'"); echo "<h1>User Info</h1>"; echo "<p>Username:" . $user['name'] . "<br>";echo "Email:" . $user['email'] . "<br>"; ?> Link to comment Share on other sites More sharing options...
nitesh Posted December 23, 2012 Share Posted December 23, 2012 (edited) Hiyou are only quering not fetching value from the database do something like this after quering $user = mysql_query("SELECT name FROM users WHERE id='$id'");$result = mysql_fetch_assoc($user);echo "<p>Username:" . $result['name'] . "<br>";echo "Email:" . $result['email'] . "<br>"; Edited December 23, 2012 by nitesh Link to comment Share on other sites More sharing options...
Colourtheory Posted December 23, 2012 Author Share Posted December 23, 2012 Still doesn't work. Link to comment Share on other sites More sharing options...
Colourtheory Posted December 23, 2012 Author Share Posted December 23, 2012 Wait, I made the username load but not the email. Confusing me.. Link to comment Share on other sites More sharing options...
Colourtheory Posted December 23, 2012 Author Share Posted December 23, 2012 (edited) <?phpsession_start();require_once 'db.php';$id = $_GET['id'];$user = mysql_query("SELECT name FROM users WHERE id='$id'");$result = mysql_fetch_assoc($user);$email = $result['email'];echo "<p>Username: " . $result['name'] . "<br>";echo "Email:" . $result['email'] . "<br>"; ?> Still not working.. hmm.. Edited December 23, 2012 by Colourtheory Link to comment Share on other sites More sharing options...
Colourtheory Posted December 23, 2012 Author Share Posted December 23, 2012 Got it, forgot to fetch email. My bad. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now