You are here: Re: any way to avoid millions of 'if' args??? please. « PHP Language « IT news, forums, messages
Re: any way to avoid millions of 'if' args??? please.

Posted by Tony on 07/19/05 00:36

Peter Butler wrote:
> Geoff Berrow <blthecat@ckdog.co.uk> wrote in message
>
>> I still don't get what you are trying to do but I'd agree there must
>> be an easier way.
>
> I am trying to get php to dynamically create the correct combination
> of arguments to formulate a complex Mysql query, based on which
> combination of $vars have been passed to the result.php script.
>
> Instead of physically listing every single possible combination of 14
> different variables...

Can you build the query in parts?

Something like:

$query = "SELECT * FROM table WHERE ";

if ($a=='a') {
$query .= "a='$a' ";
}
if ($b=='a') {
$query = "AND b='$b'"
}

(I know it's a bad example - but you should get the basic idea)

--
Tony Garcia
Web Right! Development
Riverside, CA
www.WebRightDevelopment.com

 

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

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