Page 1 of 1

ok back again

Posted: Sat May 15, 2004 5:48 pm
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

Posted: Sat May 15, 2004 5:50 pm
by feyd

Code: Select all

if(mysql_num_rows($sql_member) > 0)

OMG D00D you are awesome

Posted: Sat May 15, 2004 6:01 pm
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

Posted: Sat May 15, 2004 6:05 pm
by feyd
that's what we're here for. :)

tim would add beer to that list :P

Posted: Sat May 15, 2004 7:28 pm
by d3ad1ysp0rk
also, no need to go in and out of php like you do (after the include)