ChidoriSoul Posted October 5, 2009 Share Posted October 5, 2009 Hey! I am trying to create a view_profile system, and I am having a bit of trouble making where it says:view_profile.php?id=1I need to figure out how to make the ending where it shows the information based on the user information on the link.Can anyone help me? Link to comment Share on other sites More sharing options...
sooty2006 Posted October 5, 2009 Share Posted October 5, 2009 view_profile.php?id=1on the view_profile.phpif($_GET['id']){$query = mysql_query("SELECT * FROM `users` WHERE `id` = '$_GET[id]'");$array = mysql_fetch_array($query);print "$array['username']";}else{print "No such user.";}does this solve your problem? Link to comment Share on other sites More sharing options...
ChidoriSoul Posted October 5, 2009 Author Share Posted October 5, 2009 IT does, but I get this error: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/www/pokemonplanet.awardspace.info/view_profile.php on line 12 Line 12 is : Print "$array['name']"; Link to comment Share on other sites More sharing options...
Synook Posted October 5, 2009 Share Posted October 5, 2009 print $array['name']; or print "{$array['name']}"; Link to comment Share on other sites More sharing options...
ChidoriSoul Posted October 6, 2009 Author Share Posted October 6, 2009 Ok, thank you, the error is now gone, but what I am really looking for is how to get the ending there so it gives each user a specific profile. Link to comment Share on other sites More sharing options...
Synook Posted October 6, 2009 Share Posted October 6, 2009 Oh, well, on the view_profile.php page, you can use the querystring var to select the user's record from the database, and displays the information: $id = (int) $_GET['id'];$result = mysql_query("SELECT * FROM users WHERE id = $id");$user = mysql_fetch_assoc($result);echo "<h1>{$user['name']}</h1>";echo "<p>This user is {$user['age']} years old.</p>";///etc. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.