Php Output Query, Help Required...
Posted: Fri May 15, 2009 4:24 pm
Hiya people,
No surprise but I require some help with a small piece of PHP…
Aim: What I’m trying to do is grab the username that is stored within Session information, and then pass this into my Sql query, so I’d have something along the lines of this
Reason: I’m trying to feed data into a page that is only associated with the user who is browsing, for example, if I was designing a profile page then, I would only want the user to be capable of editing their own information and as a result should only be able to view there own information.
What I know: Well, to be honest not very much in PHP but if I use the following line, I know it can echo the relevant information through to the page and print the user name. This information is assigned to the session within the authentication page that was created which sets up the session/cookie.
So how would I achieve the option of assigning the username from the session and feeding it directly into my Sql statement?
Any help would be greatly appreciated people.
Regards,
Marcus
No surprise but I require some help with a small piece of PHP…
Aim: What I’m trying to do is grab the username that is stored within Session information, and then pass this into my Sql query, so I’d have something along the lines of this
Code: Select all
$sql = 'SELECT * FROM reviews WHERE Reviewer = "SESS_LOGIN";Reason: I’m trying to feed data into a page that is only associated with the user who is browsing, for example, if I was designing a profile page then, I would only want the user to be capable of editing their own information and as a result should only be able to view there own information.
What I know: Well, to be honest not very much in PHP but if I use the following line, I know it can echo the relevant information through to the page and print the user name. This information is assigned to the session within the authentication page that was created which sets up the session/cookie.
Code: Select all
<?php echo $_SESSION['SESS_LOGIN'];?>Any help would be greatly appreciated people.
Regards,
Marcus