Jump to content

Query Question


alexcrosson

Recommended Posts

OKay i have my database set up like so:

[b]id        username              password                firstname              lastname[/b]
1          sample                    ck3949                John                      DOE

Someone can login and it checks weather its the right password and then redirects them to a diferent page. On that page I want to have a message Saying "Welcome John", meaning that i need to pull the firstname out of the row of the user that is logged in.

Heres my code:

[code]$query = mysql_query("SELECT firstname FROM users WHERE username='$user'") or die ("Can't execute: " . mysql_error());
$name = $query
?>
  <h1>Welcome <? print $name; ?>,</h1>[/code]

And i don't get any errors but my output is:

[b]Welcome Resource id #4[/b]

Any idea?
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.