on 4/11/00 2:44 AM, Kent Nguyen <[EMAIL PROTECTED]> wrote:
> When you shop at amazon, u see when you open a browser it said "Welcome
> Kent Nguyen". You can do the same to FreeTrade here's how.
>
> Put this code snipped in page_top or something
>
Instead of doing two hits to the database and useless while loops, you can
simply do a JOIN and hit the database once and not use useless while loops.
There is no reason why you should be getting back multiple rows because
userId is a unique column.
<?
$userId = $UserInfo["ID"];
if ($userID > 0)
{
$sql = "SELECT addr.Name_First, addr.Name_Last FROM User user,
Address addr WHERE user.ID=$userID AND user.Address=Adress.ID";
$row = mysql_fetch($sql);
$last = $row["addr.Name_Last"];
$first = $row["addr.Name_First"];
}
?>
This code is untested (I haven't done any real PHP code in about 2 years),
but it should give you an idea how to write it.
Also, I would write that as a function so that you can just get at it from
anywhere...it is a cleaner approach.
-jon
--
Scarab -
Java Servlet Based - Open Source
Bug/Issue Tracking System
<http://scarab.tigris.org/>
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Site: http://www.working-dogs.com/freetrade/
Problems?: [EMAIL PROTECTED]