New online RPG, in EARLY development

Obliterate
Unregistered
 
Post: #1
Hi all, i spoke on iDev forums before about a new website i was developing (SLOWLY lol). Im stuck at a point in my development now though and am looking for help with php.

What i am looking to do is sort out a profile. You can enter a signature when you register and this gets stored in the MySql table fine, the problem is recalling it. I figured a session would be good to use in this situation and have just got trouble creating the session correctly.

$_SESSION['signature'] = ("SELECT sig FROM users WHERE username = '".$_POST['uname']."'");

That is the code i have used to create the session, now i am still learning php so i dont know why it doesnt work. When i write <? echo $_SESSION['signature']; ?> get the words "SELECT sig FROM users WHERE username = Users_username_here"

Please help, thanks

James

P.s if you wish to look at the site, goto http://www.thetrial.staronesw.com you then click register and make an account. At this point in time you dont need to enter a valid email if you dont want to. Grin

Thanks again
Quote this message in a reply
Moderator
Posts: 771
Joined: 2003.04
Post: #2
Missing mysql_query Wink ?
Quote this message in a reply
Obliterate
Unregistered
 
Post: #3
Ok so is this right?

$sql = "SELECT sig FROM users WHERE username = '".$_POST['uname']."'";
$sig = mysql_query($sql) or die(mysql_error());

Use that code to get the data from the table, then use $sig in the session instead of writing,

$_SESSION['signature'] = (SELECT sig FROM users WHERE username = '".$_POST['uname']."'")

Thanks Wink
Quote this message in a reply
Moderator
Posts: 608
Joined: 2002.04
Post: #4
You'll need to $result = myself_fetch_assoc($sig) and then $_SESSION['signature'] = $result["sig"], IIRC. It's been a while since I did anything MySQL-y.
Quote this message in a reply
Post Reply