You are here: Re: [PHP] if then else « PHP « IT news, forums, messages
Re: [PHP] if then else

Posted by Richard Lynch on 10/21/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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация