PHP - Link To Profile Page
Hello.
Say i want to view another user profile. I click on user name and i see the profile page. So how can i link user name to his profile? I have tried linking it to $id (this is where user id is stored in the database), but no luck. Thank you. Similar TutorialsI am having trouble figuring this out myself, so hopefully someone can help me out. What I am trying to do is write a code to link an image to a logged in users "edit profile" page. Right now, the page address the image needs to be linked to would be: "MyCollegeFleaMarket.com/users/Username" Currently, the code I have in place is this: "users/<?php global $user; if ($user->uid) { print $user->name; } ?>"> but this is creating a link to, "MyCollegeFleaMarket.com/content/users/Username. Thanks for your help! Hi all, I am currently facing a problem, if you look at 'viewprofile.jpg' attachment, you can see that there is an uploaded profile picture. However when I click to edit the profile, the picture is missing (editprofile.jpg), I am just wondering what went wrong? Can someone guide me in troubleshooting this problem? Code: [Select] <?php if (isset($_POST['submit'])) { // Validate and move the uploaded picture file, if necessary if (!empty($new_picture)) { if ((($new_picture_type == 'image/gif') || ($new_picture_type == 'image/jpeg') || ($new_picture_type == 'image/pjpeg') || ($new_picture_type == 'image/png')) && ($new_picture_size > 0) && ($new_picture_size <= CT_MAXFILESIZE)) { //0 indicates a success, other values indicate failure if ($_FILES['file']['error'] == 0) { // Move the file to the target upload folder $target = CT_UPLOADPATH . basename($new_picture); if (move_uploaded_file($_FILES['new_picture']['tmp_name'], $target)) { // The new picture file move was successful, now make sure any old picture is deleted if (!empty($old_picture) && ($old_picture != $new_picture)) { @unlink(CT_UPLOADPATH . $old_picture); } } else { // The new picture file move failed, so delete the temporary file and set the error flag @unlink($_FILES['new_picture']['tmp_name']); $error = true; echo '<p class="error">Sorry, there was a problem uploading your picture.</p>'; } } } else { // The new picture file is not valid, so delete the temporary file and set the error flag @unlink($_FILES['new_picture']['tmp_name']); $error = true; echo '<p class="error">Your picture must be a GIF, JPEG, or PNG image file no greater than ' . (CT_MAXFILESIZE / 1024). '</p>'; } } // Grab the profile data from the POST $name = mysqli_real_escape_string($dbc, trim($_POST['name'])); $nric = mysqli_real_escape_string($dbc, trim($_POST['nric'])); $gender = mysqli_real_escape_string($dbc, trim($_POST['gender'])); $old_picture = mysqli_real_escape_string($dbc, trim($_POST['old_picture'])); $new_picture = mysqli_real_escape_string($dbc, trim($_FILES['new_picture']['name'])); $new_picture_type = $_FILES['new_picture']['type']; $new_picture_size = $_FILES['new_picture']['size']; list($new_picture_width, $new_picture_height) = getimagesize($_FILES['new_picture']['tmp_name']); $error = false; // Update the profile data in the database if (!$error) { if (!empty($name) && !empty($nric) && !empty($gender)) { $query = "UPDATE tutor_profile SET name = '$name', nric = '$nric', gender = '$gender' WHERE tutor_id = '" . $_GET['tutor_id'] . "'"; mysqli_query($dbc, $query) or die(mysqli_error($dbc)); // Confirm success with the user echo '<p>Your profile has been successfully updated. Would you like to <a href="viewprofile.php?tutor_id=' . $_GET['tutor_id'] . '">view your profile</a>?</p>'; mysqli_close($dbc); exit(); } else { echo '<p class="error">You must enter all of the profile data (the picture is optional).</p>'; } } } // End of check for form submission else { // Grab the profile data from the database $query = "SELECT name, nric, gender FROM tutor_profile WHERE tutor_id = '" . $_GET['tutor_id'] . "'"; $data = mysqli_query($dbc, $query) or die(mysqli_error($dbc)); // The user row was found so display the user data if (mysqli_num_rows($data) == 1) { $row = mysqli_fetch_array($data); if ($row != NULL) { $name = $row['name']; $nric = $row['nric']; $gender = $row['gender']; } else { echo '<p class="error">There was a problem accessing your profile.</p>'; } } } mysqli_close($dbc); ?> <form enctype="multipart/form-data" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo CT_MAXFILESIZE; ?>" /> <ul id="tabSet_ep"> <li><a href="#panel1">Personal Profile</a></li> <li><a href="#panel2">Qualifications</a></li> <li><a href="#panel3">Tutor\'s Comments/Commitment</a></li> <li><a href="#panel4">Tutoring Levels/Subjects</a></li> </ul> <!--Personal Profile--> <div id="panel1"> <label for="new_picture">Pictu </label> <input type="file" id="new_picture" name="new_picture" /> <?php if (!empty($old_picture)) { echo '<img class="profile" src="' . CT_UPLOADPATH . $old_picture . '" alt="Profile Picture" />'; } ?><br /> <label for="firstname">First name:</label> <input type="text" id="firstname" name="firstname" value="<?php if (!empty($name)) echo $name; ?>" /><br /> <label for="lastname">Last name:</label> <input type="text" id="lastname" name="lastname" value="<?php if (!empty($nric)) echo $nric; ?>" /><br /> <label for="gender">Gender:</label> <select id="gender" name="gender"> <option value="M" <?php if (!empty($gender) && $gender == 'M') echo 'selected = "selected"'; ?>>Male</option> <option value="F" <?php if (!empty($gender) && $gender == 'F') echo 'selected = "selected"'; ?>>Female</option> </select><br /> </div> <input type="submit" value="Save Profile" name="submit" /> </form> Hi, I have to ask about profile page for each user like facebook and netlog. As u can see in netlog it is like this http://en.netlog.com/ElegantLeo and i have a site http://cyprussaver.com/merchant.php?id=64 and here each merchant profile can be viewed like this but i need to show them like this http://cyprussaver.com/rocksman please guide me what i have to do in order to achieve this result. Thanks, Hanan ALi Hello, I'm a new member and i want to say a compliment to the php coders. Well, in the profile page i want to insert to box. The first can be modified by the user and by the staff And the second can be inserted comments only by the staff.. We don't have a profile page to modify the date but, is possible insert only that? How can i do that? Naturally the staff comments can be modifed by the staff area. Thanks I was looking at various tutorials on the net to help me create an edit profile page for my site but the ones I tried wouldn't work... What changes would I have to make to this: (register.php) <?php include ('header.php'); ?></center> <div class=content> <?php if(!empty($_POST['username']) && !empty($_POST['password'])) { $username = mysql_real_escape_string($_POST['username']); $password = md5(mysql_real_escape_string($_POST['password'])); $email = mysql_real_escape_string($_POST['email']); $location = mysql_real_escape_string($_POST['location']); $website = mysql_real_escape_string($_POST['website']); $about = mysql_real_escape_string($_POST['about']); $checkusername = mysql_query("SELECT * FROM users WHERE Username = '".$username."'"); if(mysql_num_rows($checkusername) == 1) { echo "<b>Error</b>"; echo "Sorry, that username is taken. Please go back and try again.</p>"; } else { $registerquery = mysql_query("INSERT INTO users (Username, Password, EmailAddress, Location, Website, About) VALUES('".$username."', '".$password."', '".$email."', '".$location."', '".$website."', '".$about."')"); if($registerquery) { echo "<b>Success!</b>"; echo "Your account was successfully created. Please click<a href=\"index.php\"> here </a>to login."; } else { echo "<b>Error</b>"; echo "<p>Sorry, your registration failed. Please go back and try again.</p>"; } } } else { ?> <b>Register</b> <br><br> Please enter your details below to register. <br><br> <form method="post" action="register.php" name="registerform" id="registerform"> <table width=700px border=0 cellspacing=10><tr><td valign=top><table border=0> <b>Required Information:</b><br><br> <tr><td> <b>Username:</b> </td><td> <input type="text" name="username" id="username" /> </td></tr><tr><td> <b>Password:</b> </td><td> <input type="password" name="password" id="password" /> </td></tr><tr><td> <b>Email Address:</b> </td><td> <input type="text" name="email" id="email" /> </td></tr></table></td><td valign=top> <table border=0> <b>Optional Information:</b><br><br> <tr><td> <b>Location:</b> </td><td> <input type="text" name="location" id="location"> </td></tr><tr><td> <b>Your Website:</b> </td><td> <input type="text" name="website" id="website"> </tr></td><tr><td valign=top> <b>Short About:</b> </td><td> <textarea name="about" id="about" rows="10" cols="20"></textarea> </td></tr></td> </table> </td></tr> </table> <input type="submit" name="register" id="register" value="Register" class=btn /> </form> <?php } ?> </div> <?php include ('footer.php'); ?> an edit profile page? I use this as the template because its damn near the same script, just with a few alterations... I know the obvious things the bit I struggle with is selecting the database then inserting new information?...I keep getting my variables/queries messed up when I rewrite it to create a edit profile page. Cheers, I've been working on a project and I have pretty much everything set up with a registration page, login and logout. After the user logs in it directs it to index.php. That's where it it ends. How do I start the page where it will display something like Hello, username! and than anything else the user has done in his or her account. Does anyone know a good tutorial? Thanks hi all, i have a profile page which is a form that asks users to enter there personal details such as name, location, mobile number etc and saves this info with a mysql database, however when you return to the edit profile page the fields are blank and i want them to pull the details the user has entered (if any) and display it, so if a user entered there name as Lee, then returned to the edit profile page there name field would show lee instead of being empty. heres my profiles page code, any help would be great Code: [Select] <?PHP session_start(); if (!(isset($_SESSION['username']) && $_SESSION['username'] != '')) { header ("Location: login.php"); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- Author: Reality Software Website: http://www.realitysoftware.ca Note: This is a free template released under the Creative Commons Attribution 3.0 license, which means you can use it in any way you want provided you keep the link to the author intact. --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> <link href="style.css" rel="stylesheet" type="text/css" /> <style type="text/css"> .auto-style2 { font-size: 25px; } </style> </head> <body> <div id="container"> <!-- header --> <div id="header"> <div id="logo"><a href="#"><span class="orange">SouthWest</span> LAN's</a></div> <div id="menu"> <ul> <li><a href="index.php">home</a></li> <li><a href="register.php">Register</a></li> <li><a href="account.php">My Account</a></li> <li><a href="forum.php">Forums</a></li> <li><a href="faq.php">FAQ</a></li> </ul> </div> </div> <!--end header --> <!-- main --> <div id="main"> <div id="content"> <div id="head_image"> <div id="slogan"><strong><span class="auto-style2">Organising LAN Parties in the SouthWest</span></strong><br /></div> <div id="under_slogan_text"></div> </div> <div id="text"> <h1>Edit Profile</h1> <br /> <form name="register" method="post" action="process_p.php"> <table border="0" width="225" align="center"> <tr> <td width="219" bgcolor="#999999"> <p align="center"><font color="white"><span style="font-size:12pt;">Please fill out as much as possible</span></font></p> </td> </tr> <tr> <td width="219"> <table border="0" width="282" align="center"> <tr> <td width="116"><span style="font-size:10pt;">Username: </span></td> <td width="156"><?php echo $_SESSION['username']; ?></td> </tr> <tr> <td width="116"><span style="font-size:10pt;">Email: </span></td> <td width="156"><input type="text" name="email" maxlength="30"></td> </tr> <tr> <td width="116"><span style="font-size:10pt;">Real Name: </span></td> <td width="156"><input type="text" name="real_name"></td> </tr> <tr> <td width="116"><span style="font-size:10pt;">Location: </span></td> <td width="156"><input type="text" name="location"></td> </tr> <tr> <td width="116"><span style="font-size:10pt;">Mobile Number: </span></td> <td width="156"><input type="text" name="mobile_number"></td> </tr> <tr> <td width="116"><span style="font-size:10pt;">Instant Messager: </span></td> <td width="156"><input type="text" name="instant_messaging"></td> </tr> <tr> <td width="116"> </td> <td width="156"> <p align="right"><input type="submit" name="update" value="Update Profile"></p> </td> </tr> </table> This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=347558.0 I'm trying to set up a very simple (WIP) members page that you can click registered users to see their profile page that will display basic information. I'm having trouble with the sessions and retrieving this info from my database. I'm very new to this so it's all pretty amateur. I've been looking at this code for several hours trying to fix things but I start to make some progress, then change stuff, and go backwards. I had a members page that displayed the registered users in my database, but after a while of altering to try to get the profiles to work, I messed it up :mad:. I have basic login and register pages. I need some seperate eyes to take a look. Any help is so much appreciated. Thanks! members.php Code: [Select] <?php session_start(); require 'mysql-connect.php'; $auser=$_SESSION['user']; if(isset($auser)){ $Members = mysql_query("SELECT * FROM user WHERE username='$username'") or die(mysql_error()); $numRowsMembers = mysql_num_rows($Members); ?> <table border="1"> <?php for($count = 1; $count <= $numRowsMembers; $count++) { $name = mysql_fetch_array($Members); ?> <tr> <?php echo '<td><a href="member_profile.php?username=' . $name['username'] . '">' . $name['username'] . '</a></td>'; } } ?> </tr> </table> member_profile.php Code: [Select] <?php session_start(); require 'mysql-connect.php'; $auser=$_SESSION['user']; if(isset($auser)){ $username = $_GET['username']; $user = mysql_query("SELECT * FROM user WHERE username = '$username'"); echo $user; $user=mysql_fetch_assoc($user); echo "<h1>User Info</h1>"; echo "<b>Username:".$user['username']."<br>"; echo "<br>"; echo '<form name="backlistfrm" method="post" action="members.php">'; echo '<input type="submit" value="Back to The List">'; echo '</form>'; echo "<br>"; } ?> my login handler Code: [Select] <?php include 'mysql-connect.php'; $username = $_POST['user']; $password = $_POST['pass']; $query1 = mysql_query("SELECT * FROM user WHERE username='$username'"); $result = mysql_num_rows($query1); if($result == 0) { echo '<h1>Error!</h1>The username you specified does not exist!'; } else { $checkuser = mysql_query("SELECT * FROM user WHERE username='$username'"); $row = mysql_fetch_array($checkuser); $password2 = $row['password']; //$status = $row['status']; if ($password == $password2) { echo "Hi $username."; include("index.php"); } else { echo '<h1>Error!</h1>The username and password combination you entered does not match the ones we have in the database.'; } } ?> mysql-connect.php Code: [Select] <?php $host = "localhost"; $username = "root"; $password = ""; $database = "ug54"; $link = mysql_connect($host, $username, $password);//Connects to database with host, username, and password $select = mysql_select_db($database); ?> and my simple database Code: [Select] CREATE TABLE IF NOT EXISTS `user` ( `id` int(4) unsigned NOT NULL AUTO_INCREMENT, `username` varchar(32) NOT NULL, `password` varchar(32) NOT NULL, `firstname` varchar(20) NOT NULL, `lastname` varchar(20) NOT NULL, `email` varchar(30) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ; -- -- Dumping data for table `user` -- INSERT INTO `user` (`id`, `username`, `password`, `firstname`, `lastname`, `email`) VALUES (1, '', '', '', '', '0'), (2, 'abc', '123', '', '', '0'), (3, 'a', 'b', 'c', 'd', '0'), (4, 'hfg', 'rgfdg', 'gdfg', 'dfgdf', '0'), (5, '999', '999', '999', '999', '999'); Hi, I have a "user profile" page and it has a profile image upload form. I have it so that the old profile image is deleted, and the new image is uploaded and the new image is echoed out using the name of the new file from the database. The problem is, when I click submit to add the new image, the old image still stays there and the new image does not show up. Only when I manually click refresh on my browser does the new image show up. That is going to be bad for my users. Please if anyone can help, I'd greatly appreciate it. Below is the code I am using to delete the old image, and code to upload the image as well, when the photo upload form is used. Code: [Select] if(isset($_POST['photoUpload'])) { if(file_exists("images/".$currentUser.".jpg")){ unlink("images/".$currentUser.".jpg"); clearstatcache(); } //reads the name of the file the user submitted for uploading $image=$_FILES['image']['name']; //if it is not empty if ($image) { //get the original name of the file from the clients machine $filename = stripslashes($_FILES['image']['name']); //get the extension of the file in a lower case format $extension = getExtension($filename); $extension = strtolower($extension); //if it is not a known extension, we will suppose it is an error and will not upload the file, //otherwise we will do more tests if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") && ($extension != "gif")) { //print error message echo '<h1>Unknown extension!</h1>'; $errors=1; } } //end if here //was else here //get the size of the image in bytes //$_FILES['image']['tmp_name'] is the temporary filename of the file //in which the uploaded file was stored on the server $size=filesize($_FILES['image']['tmp_name']); //compare the size with the maxim size we defined and print error if bigger if ($size > MAX_SIZE*1024) { echo '<h1>You have exceeded the size limit!</h1>'; $errors=1; } //we will give an unique name, for example the time in unix time format $image_name= $currentUser .'.'.$extension; //$image_name=time().'.'.$extension; //the new name will be containing the full path where will be stored (images folder) $newname=$image_name; //"images/". // Connects to your Database mysql_connect("host", "user", "pass") or die(mysql_error()); mysql_select_db("database") or die(mysql_error()) ; //we verify if the image has been uploaded, and print error instead $copied = copy($_FILES['image']['tmp_name'], "images/".$newname); // update the photo name in the database $result = mysql_query("UPDATE users SET profilePhoto='$newname' WHERE username='$currentUser'") or die(mysql_error()); if (!$copied) { echo '<h1>Copy unsuccessful!</h1>'; $errors=1; } else{ $dir="images/"; echo "<p>Profile Picture Change Successful!</p>"; echo "<img src='{$dir}{$newname}' alt='{$newname}' height='200' width='200' />"; echo "<p></p>"; } } Hi phpfreaks members, I got a little social network website, http://www.tranceprofile.com I got a php script for members to log in to my website. When they are logged in they can view there own profile and edit it. I got my login script on two places, http:www.tranceprofile.com/login.php and my index.php page. Well here is my problem: When they log in they are send to my index.php page as a logged in user. I want them to be redirected to the http://www.tranceprofile.com/profile.php page. I hope you guys can help me out! Best regards, Mitch Oosterhuis. Login script: <table width="400" align="center" cellpadding="6" style="background-color:#FFF; border:#666 1px solid;"> <form action="login.php" method="post" enctype="multipart/form-data" name="signinform" id="signinform"> <tr> <td width="23%"><font size="+2">Log In</font></td> <td width="77%"><font color="#FF0000"><?php print "$errorMsg"; ?></font></td> </tr> <tr> <td><strong>Email:</strong></td> <td><input name="email" type="text" id="email" style="width:60%;" /></td> </tr> <tr> <td><strong>Password:</strong></td> <td><input name="pass" type="password" id="pass" maxlength="24" style="width:60%;"/></td> </tr> <tr> <td align="right"> </td> <td><input name="remember" type="checkbox" id="remember" value="yes" checked="checked" /> Remember Me</td> </tr> <tr> <td> </td> <td><input name="myButton" type="submit" id="myButton" value="Sign In" /></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td colspan="2">Forgot your password? <a href="forgot_pass.php">Click Here</a> <br /></td> </tr> <tr> <td colspan="2">Need an Account? <a href="register.php">Click Here</a><br /> <br /></td> </tr> </form> </table> Hi, I am making a dating site where I have made the user profile edit page visible to the user when they log in, and I think I can get away with not showing the user their "public" profile view. But I definitely need to show other users on the site the "public" non editing profile page view. But I don't know how to do this. I have yet to create the search, search results, thumbnails with optional descriptions of the possible dating results. But I first want to just get 2 versions of the user profile page view. One that the user sees that I have already done. (The editable one). And the other I need to make which is the page the other users will see, (The public profile) Please if anyone has any idea how to do this I would greatly appreciate it, especially if you have any pseudocode ideas. thank you. Hi guys, I am trying to put together a little system that allows users to log onto my website and access there own personal page. I am creating each page myself and uploading content specific to them which cannot be viewed by anyone else. I have got the system to work up as far as: 1/ The user logs in 2/ Once logged in they are re-directed to their own page using 'theirusername.php' Thats all good and working how I need it too. The problem I have is this. If I log onto the website using USER A details - I get taken to USER A's page like I should but - If I then go to my browser and type in USERBdetails.php I can then access USER B's page. This cannot happen!! I need for USER A not to be able to access USER B profile - there is obviously no point in the login otherwise! If you are not logged in you obviously cannot access any secure page. That much is working! Please find below the code I am using: LOGIN <?php session_start(); function dbconnect() { $link = mysql_connect("localhost", "username", "password") or die ("Error: ".mysql_error()); } ?> <?php if(isset($_SESSION['loggedin'])) { header("Location:" . strtolower($username) . ".php"); if(isset($_POST['submit'])) { $username = mysql_real_escape_string($_POST['username']); $password = mysql_real_escape_string($_POST['password']); $mysql = mysql_query("SELECT * FROM clients WHERE username = '{$username}' AND password = '{$password}'"); if(mysql_num_rows($mysql) < 1) { die("Password or Username incorrect! Please <a href='login.php'>click here</a> to try again"); } $_SESSION['loggedin'] = "YES"; $_SESSION['username'] = $username; $_SESSION['name'] header("Location:" . strtolower($username) . ".php"); } ?> HEADER ON EACH PHP PAGE <?php session_start(); if(!isset($_SESSION['loggedin'])) { die(Access to this page is restricted without a valid username and password); ?> --------------------------------------------------- Am I right in thinking it is something to do with the "loggedin" part? The system I have here is adapted from a normal login system I have been using for years. The original just checks the details and then does a 'session start'. This one obviously has to re-direct to a user specific page. To do this I used the <<header("Location:" . strtolower($username) . ".php");>> line to redirect to a page such as "usera.php" or "userb.php" Any help would be greatly appreciated! Ta Hello.
I have a bit of a problem. When I fetch the link field from the database.i don't see an actual link on the page.
One more thing, what type of field should I use to store the link in the database? Probably there is where I went wrong.
All help is
Hi, Is it possible to build a PHP Template page that selects and publishes a row of data from a MySQL Database when a linked is clicked? I would design: Template.php Text links (perhaps on homepage of navigation bar): ProductA, ProductB and ProductC If you click link ProductA Template.php would display data for ProductA and likewise for ProductB and ProductC. I would also like search engines for find ProductA, ProductB and ProductC PHP pages. (Not just my single Template.php) Any ideas as to how this could be done without designing individual PHP pages for each product? Kind regards, Matthew. I need help with this script...... i get the error... 'Undefined index: username in C:\wampnew\www\login and register\profile.php on line 28!' <?php require("include/connect.php"); if(!isset($_GET['id'])) { echo("Please enter a members profile to view."); die(); } elseif($_GET['id'] == "") { echo("Please enter a members profile to view."); die(); } $pid = mysql_real_escape_string(preg_replace("@[^a-z0-9]@i","",$_GET['id'])); $check = mysql_num_rows(mysql_query("SELECT id FROM tut_users WHERE id='{$pid}'")); if($check !="1") { echo("Member does not exist."); require("footer.php"); die(); } $sql = mysql_query("SELECT * FROM tut_users WHERE id='{$pid}'") or die(mysql_error()); $fetch = mysql_fetch_assoc($sql) or die(mysql_error()); $username = mysql_real_escape_string(preg_replace("@[^a-z0-9]@i","",$fetch['username'])); echo("Member Profile Of: {$username} <br /> " ); ?> Could someone please help me thanks... Hi everyone, i have currently have a registration and login page working, i have now included a profile/edit profile page once the user is logged in. However im having a problem, once the user logs in the account page welcomes them by there username using the following code <h2>Welcome, <?php echo $_SESSION['username']; ?></h2> Which is fine, however when users edit there profile there details arent stored into there userid within the mysql database. for example this is my edit profile page and this is what it does within the mysql database: It doesn't save that info to the current user and im not sure how to get it to do it, heres my code: <?PHP //Database Information $dbhost = "localhost"; $dbname = "blank"; $dbuser = "blank"; $dbpass = "password"; //Connect to database mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error()); mysql_select_db($dbname) or die(mysql_error()); $real_name = $_POST['real_name']; $location = $_POST['location']; $mobile_number = $_POST['mobile_number']; $instant_messaging = $_POST['instant_messaging']; $query = "REPLACE INTO users (real_name, location, mobile_number, instant_messaging) VALUES('$real_name', '$location', '$mobile_number', '$instant_messaging')"; mysql_query($query) or die(mysql_error()); mysql_close(); ?> I can see why it doesn't work as it just inserts it into the users database but I'm not sure how to associate it with the current logged in user. Any help would be great, Lee Hi guys, Im trying to get my members_profile.php to display the users profile.... I.e members_profile.php?boxerman will display my information. I've been at it for hours but no luck... This is what im trying to code: <?php include ("connect.php") $username = $_GET['username']; $user = mysql_query("SELECT * FROM user WHERE username = '$username'"); $user=mysql_fetch_assoc($user); echo "<h1>User Info</h1>"; echo "<b>Username:".$user['username']."<br>"; echo "<br>"; echo '<form name="backlistfrm" method="post" action="members.php">'; echo '<input type="submit" value="Back to The List">'; echo '</form>'; echo "<br>"; ?> It displays nothing when going to members_profile.php?boxerman Any advice as to why? Regards, B-Man Hello, first of all i'm new here and i kinda like the community... so here i go with my question... When i register and then click on the link to get me to the log in file i have set the link for my member profile to be member.php?p=$_SESSION['id'] .. which works until now.. and lets say for instance my ID is 25... when i type on the browser member.php?p=553524 i will still be on the same page... so what i want to do is to check which id is typed and then throw them to the correct account profile or if the ID does not exist then throw them to a member-not-exist.php file.. I think i can do the how to check the id if it does exist but for the other one? Thanks in advance. |