logo-dw

Go Back   Dreamweaver Club Forums > Hand Coders Forum > PHP
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 05-23-2012, 03:04 PM   #1
Kristy S
 
Join Date: May 2012
Posts: 1
Default Personalized Welcome Message

Hi all, this is my very first post here. I am having a small issue and I believe it has something to do with my where clause in MySQL that I am missing.
I am using Dreamweaver CS5 and MySQL database. I have created a log in page and my database is updating with the usernames and passwords. So that's all good. Now once they are logged into the members.php page I would like to have a Welcome logged in username, message at the top of the page. Sort of like the one at the top of this page only saying of course Welcome.

I have created a recordset like this:
SELECT username
FROM users

When I click the test button I do see all the user names in my database table called users. So it does work however it's only pulling the very first username (that I entered into the database) no matter who's logged in. Which is not cool if Billy Bob or Susie Q is logged in and he/she sees a Welcome Kristy, message!

I did a simple google search and there was a post about needing to put a where clause of MM_users which I did try but got an error message in sql about unknown column in MM_users in where clause. Could someone help point me to the right where clause if I do infact need one. Or what I need to change to my record set to have the welcome logged in username displayed at the top of the page. Thank you so much.
Kristy S.
Kristy S is offline   Reply With Quote
Old 05-23-2012, 05:14 PM   #2
Corrosive
Corrosive's Avatar
 
Join Date: Feb 2008
Location: Bristol, England
Posts: 7,103
Default

Assuming you have created a session once the user is logged in and that carries a user's ID around the website with it then you should create a where clause using that. So select username from users where id = session_id.

That is the theory and not the code by the way!
Corrosive is offline   Reply With Quote
Old 05-24-2012, 01:59 AM   #3
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,175
Default

or on page Welcome <?php echo $row['username'] ;?> maybe, editing $row to the var you use for your recordset or session value as corrosive suggests if on a new page
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas

Last edited by edbr; 05-24-2012 at 03:56 AM..
edbr is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:32 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com