PDA

View Full Version : New online RPG, in EARLY development


Obliterate
2005.05.04, 09:54 AM
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 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. :D

Thanks again

PowerMacX
2005.05.04, 09:35 PM
Missing mysql_query ;) ?

Obliterate
2005.05.05, 04:36 AM
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 ;)

Josh
2005.05.05, 03:09 PM
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.