|
Posted by John Hopper on 03/09/06 00:45
Hi
Thanks for the response.
To be honest, I am not honestly sure if I am saving the info in a session -
how would I check this and if I'm not, implement it?
Thanks
John H
"J.O. Aho" <user@example.net> wrote in message
news:4794p0Fehh8pU1@individual.net...
> John Hopper wrote:
> > Hi all
> >
> > I am currently trying to construct a database-driven membership site.
I'm
> > using Dreamweaver MX 2004, php & MySQL.
> >
> > All works well, but what I want the member homepage to do is to say
'Hello,
> > User1' or something along those lines - and I can get it to do this.
The
> > trouble is, when User2, User3 etc log in, they all still see 'Hello,
User1'.
> >
> > I'm almost certain its to do with my SQL syntax. I can get the page to
> > display info from the database, but only if it's in the first row of the
> > database. How do I get the page to display info just for the user who
is
> > actually logging in?
> >
> > Ok, basics first:
> >
> > The information is stored in a table called 'core'
> > The field names I want to display dynamically are called 'username'
'fname'
> > & 'lname'
> > Primary id key is called 'id' and is auto increment.
> >
> > My attempt to get the database to show the information relating only to
the
> > logged in user is as follows:
> >
> > *********************
> > SELECT username, fname, lname
> > FROM core
> > WHERE core.id = id
> > *********************
>
> When a user logs in, I guess they do enter their 'username' and
'password',
> when you have verified the 'username' and 'password', do you save the id
in a
> session/cookie?
>
> $query="SELECT username, fname, lname FROM core WHERE id='$id'";
>
> You need in this case get the id, which we assume you did save in a
> session/cookie, and store it in the variable $id.
>
> If you don't do this, then you won't get the right user information, as
you
> really don't know who the user is after they have logged in. (there aren't
> anything really wrong with your SQL statment, so it's more likely you
messed
> things up in your php code).
>
>
> //Aho
[Back to original message]
|