Jump to content

Profile tutorial


OriginalBoy

Recommended Posts

Some clarification...you have a user system where they can login?  So they have usernames and passwords, and you just want them to be able to add user information?  That is not too difficult...if I get a chance I will post some example code.  If that is not exactly what you are trying to do, just let me know.

Link to comment
Share on other sites

<?php

// Assuming user has been logged in, and the username has been passed to the URL
// E.G. www.somewhere.com/user.php?user=johndoe
// The login file needs to redirect to that (^) page
/*
Assuming you have a database named "user_info" with these columnames, in this order:
ID (serial)
username
password
email
name
personal description

*Note: this is just an example of columns you could have.
*/

if(isset($_GET['user'])) {
// Connect to the database
$user = $_GET['user'];
$query = "SELECT * from user_info where username = \"$user\"";
$user_info = mysqli_query($connection,$query);
while($row = mysqli_fetch_row($user_info)) {
$email = $row[3];
$name = $row[4];
$pers_descr = $row[5];
echo "<h3>$user</h3>\n<p>Email: $email</p>\n<p>$name: $name</p>\n<p>Personal Description:</p>\n";

}
// *Note: this will perform the query, no mattter if they are logged in or not
}

else { 
// User needs add a username to the URL
header("Location: index.php");
}

?>

 

*Note: this was not tested

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.