Jump to content

New PHP MYSQL devotee needs help


Recommended Posts

Good day all.

I am very new to this php-mysql language, having come from using frontpage as my designer. I recently switched to dreamweaver after hearing folks sing its praise. I am now building a website with mysql database which I have already created, having used phpmyadmin(great tool), I have also layed out my pages but my problem is getting the login and data display pages to work. The data insertion works like a breeze, but I cannot seem to get the right way to get deamweaver setup these other pages correctly, because I want to use a username and password criteria to display data from the mysql database when user logs in, and only his data, hence the username and password criteria. The most I can get from dreamweaver is to use only password, via the recordset. When I try advanced mode it crashes because I cannot get the parameters correct. I used to do this fine and well with frontpage and access database. I wonder if I shouldn't go back to frontpage and access, it served my purpose only that I want to try new technologies in webdesign. I would appreciate any and all help anyone can render towards solving this problem. In a nutshell I need to display user data when he logs in with his username and password.

Thank you all.

Link to comment
Share on other sites

If am not mistaken, basically you want a profile page to show up of this persons data? Try this, as the profile page:

ob_start();
session_start();
$username = $_SESSION['username']; //grabs the username from previous page

//Grab user Data
$query = "SELECT * FROM users WHERE username = '$username'"; // grabs data where username is selected
		$result = mysql_query ($query);
		$row = mysql_fetch_array ($result, MYSQL_ASSOC);
		if ($result) 
		{
			$_SESSION['username'] = $row[username]; //change session to row
			$_SESSION['password'] = $row[password];
		}
		?>
   <br />
   USERNAME: <? print $_SESSION['username']; ?><br /> 
 PASSWORD: <? print $_SESSION['password']; ?><br /> 

You can also change the $query to

	$query = "SELECT * FROM users WHERE username = '$username'" AND password='$password'";

if you want to match both of them/"hightened" security.

 

Whooh, hope that helps somewhat. ^_^;

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.