|
Posted by Richard Lynch on 10/19/28 11:15
On Wed, May 4, 2005 12:20 am, Anasta said:
> Can anyone help with a statement, ive tried but it never works.
> I need to show a value if it is set to a specific value ie:
>
> At the moment If a user is logs in a record is updated from 'away' to
> 'online'---so i want an echo statement to show a value from another table
> if
> they are set to online or else they show another value.
> (2 seperate tables).
//This gets 'away' or 'online':
//(Or something like it in your tables)
$query = "select status from whatever where username = '$username';
..
..
..
//Choose a table based on their logged in status:
if ($status == 'away'){
$table = 'away_table';
}
else{
$table = 'online_table';
}
//Now build a query with that table:
$query = "select stuff from $table where username = '$username'";
This is just ONE way of doing it.
Depending on your table structure, there could be other, better, faster
ways to do it.
We'd need to know more about the 'away' and 'online' table[s] and a bit
more info to really help you...
--
Like Music?
http://l-i-e.com/artists.htm
Navigation:
[Reply to this message]
|