Jump to content
Sign in to follow this  
ChidoriSoul

Profile Links Echoing

Recommended Posts

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?

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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']";

Share this post


Link to post
Share on other sites
print $array['name'];

or

print "{$array['name']}";

Share this post


Link to post
Share on other sites

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.

Edited by ChidoriSoul

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...