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 AF on 10/04/90 11:21

On Fri, 15 Jul 2005 19:01:19 +0200, "Peter Butler"
<peterbutler@iafrica.com> wrote:

>I'm only 6php months old and I'm a little stuck>>>
>I'm building the front end for a database but
>
>Can someone please tell me how to avoid the millions of permutations for all
>the 'if' arguments to compose complex database queries?
>
>ie: every available combination of every posted variable
>
>I think I should be using NULL instead of 'a' if VAR not set...
>
>and I think I should be stuffing all VARS into an array (somehow?) and then
>manipulate the array items[0][1][2][3][4]etc to serve to a loop which should
>then spit out the required combination specifically as required???
>
>PLEASE tell me I'm not dreaming
>If someone could even just direct me to a good tutorial I will be enormously
>gratefull
>
>TNX in advance
>peter butler
>cape_town
>south_africa
>

I once had a similar problem with sql statements in VisualFoxpro, so I
will give you a possible solution using FoxPro terminology.

The solution I found was to have your input variables have two states:

1. Null , if there was no choice made, or

2. have the value the input operator chooses including all formatting
for constructing an SQL statement.

Then concatenate all of the fields and our statement should work.

The concatenation is the key. The choices an input operator makes
should return to the system not the field value but rather the
correctly formatted part of the SQL statement that would match the sql
statement for that field value. For an unchosen field, you would get a
null.

If you would post some sample code, I could try to show you an
example. Post a sample of the html code and post a sample of the sql
for a group of selected fields as if they had been chosen. Then I
will try to do the concatenation manually.

I have not tried this on the web, but it should work.


Best regards,

Al
http://www.affordablefloridainsurance.com
http://www.americanbestmortgages.com
http://www.americanaffordablelifeinsurance.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

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