ok back again

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
perryp5
Forum Newbie
Posts: 4
Joined: Sat May 15, 2004 4:14 pm

ok back again

Post by perryp5 »

Thank you so much for helping with my last post.

I have another problem now. I want it to say 'Welcome (username)!' if the person is registered. Got that. I would like it to say 'Welcome Guest!' if they are not registered. Im still scratchin my head on this. (bout to be bald) :wink:

Heres what I have:

Code: Select all

<?php
include ("db.php");
?>
<?php
$sql_member = mysql_query("SELECT us_name FROM twb_users WHERE us_id = '". $u_id ."'") or die (mysql_error());
if($sql_member)&#123;
list($name) = mysql_fetch_row($sql_member); 
echo "Welcome $name!";
&#125;
else&#123;
echo "Welcome Guest!";
&#125;
?>
Thanks again for the excellent help!!

Perry
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

if(mysql_num_rows($sql_member) > 0)
perryp5
Forum Newbie
Posts: 4
Joined: Sat May 15, 2004 4:14 pm

OMG D00D you are awesome

Post by perryp5 »

:D

Thanks for the Excellent help on this. As you can see I am new to php and mysql. I have learned a lot, but some things that are so simple for you are a weeks worth of headaches for me (literally). Thank you SOOO much for helping this newbie in such a fast manner.

(bows....im not worthy)

Thanks man
Perry
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

that's what we're here for. :)

tim would add beer to that list :P
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

also, no need to go in and out of php like you do (after the include)
Post Reply