Session Value
Posted: Sat Sep 01, 2007 1:08 pm
feyd | Please use
This is just sample code not necessarily correct code.
Any body willing to help on this
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I am really new on PHP.
I am working a blog. When user logs in their session is turned in but at the same time, I want to store their user name on the session (Not binary, not Boolean) so I can compare their username with one which was created during posting blogs. Anybody has any idea. By the way I am using MYSQL. Here is a sample code that I have tried.Code: Select all
$result = mysql_query("SELECT * FROM users WHERE password='$userpass' AND username='$username'") or die("Couldn't query the user-database.");
$row = mysql_fetch_array($result);
$_SESSION['username'] = $row['username'];Any body willing to help on this
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]