You are here: Re: $_GET request -> variable -> object? -> function « PHP SQL « IT news, forums, messages
Re: $_GET request -> variable -> object? -> function

Posted by Schraalhans Keukenmeester on 04/13/07 08:08

strawberry wrote:
> On Apr 13, 1:51 am, "strawberry" <zac.ca...@gmail.com> wrote:
>> I'm trying to extend a class (written by others) and was wondering if
>> there's a standard a way of passing a $_GET request to a class. Here's
>> what I have (see below). If I hardcode $where, something like
>>
>> $where = " WHERE `firstname` = 'John' "
>>
>> and then pass it as an argument into the scope of a 'select' function
>> then it works fine, but otherwise the query just appears to hang.
>>
>> I'm deliberately not including the class or class extender at this
>> stage, but I'll add them to this thread later if required.
>>
>> foreach ($_GET as $condition_key => $condition_value) {
>> $condition[] =" $condition_key = '$condition_value' ";
>> }
>> if(is_null($condition)){
>> $where = " WHERE 1 ";
>> }else{
>> $conditionString = implode('AND', $condition);
>> $where = " WHERE $conditionString ";
>> }
>
>
You're reposing the question? Or ?

I am not sure myself which is preferrable: having the class handle the
$_GET superglobal array itself, which makes the client code programming
even easier, or leaving it to the client code, allowing for more custom
use. I've seen both examples, each has their practical (dis-)advantages.

If someone has a good argument on why to prefer one over the other (or
even an entirely different way) I'd also be helped!

Sh.

 

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

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