Jump to content

help with select statement!


applebiz89

Recommended Posts

hey,

 

I have two tables in my mySQL database: login and musicians(which is basically members of the site)

 

the sign up information goes to the musicians table

 

and, when a member logs into the site their session goes into the login table with their sessionID,username,ip and time they logged in.

 

My problem is that once they have logged in, they get directed to their 'profile' page so they can view the information they inserted into the sign up form. How can I collect the information that is this users; so it queries the database by the username that is in the sessionID and gathers the information held in the musicians table, if that makes sense...

 

if there is any other way you can suggest or help that would be great. Just trying to get my head round it.

 

Thanks

Link to comment
Share on other sites

 

This is taken direct from phpMyadmin so sorry for format. but should get the Jist

 

        firstname varchar(25) latin1_general_ci Yes NULL

lastname varchar(25) latin1_general_ci Yes NULL

DOB date Yes NULL

username varchar(50) latin1_general_ci No None

password char(32) latin1_general_ci No None

instrument varchar(25) latin1_general_ci Yes NULL

location varchar(25) latin1_general_ci Yes NULL

postcode varchar(8) latin1_general_ci No None

genre varchar(25) latin1_general_ci Yes NULL

aboutsection text latin1_general_ci Yes NULL

picture blob BINARY Yes NULL

 

      Field Type Collation Attributes Null Default Extra Action

id varchar(50)  latin1_general_ci No

username varchar(10 )latin1_general_ci No

ip varchar(20) latin1_general_ci No

tm datetime No 0000-00-00 00:00:00

status  char(3) latin1_general_ci No ON

 

 

Anyways I realised how to do this by using this statement: SELECT * FROM musicians WHERE username='$_SESSION[username]';

 

and then putting this into an array and echoing each attribute...

 

 

but one question. is there anyway of putting this into a nice 'profile' sort of format. So can I just use the 'echo "<td>" . $row['username'] . "</td>";' code in perhaps a table structure..

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.