Reply to Re: How do I do this query?

Your name:

Reply:


Posted by Pedro Graca on 01/13/06 20:17

john.d.mann@sbcglobal.net wrote:
> Pedro Graca wrote:
>> Pedro Graca wrote:
>>
>>><?php
>>
>> <snip content="old version">
>>
>> Updated version
>
> Sorry to chime in here, but I just don't get why this is such a
> complicated task. I could have the same result in far less code - and
> even much less complex code.

The first version was hard coded to the desired result.
What if, "out of the blue", you wanted to reverse the final table:

instead of you'd like

name bio psych chem grade joe jill john
joe a - - bio a - -
jill - a b psych - a b
john - b a chem - b a


If you got stuck with the simple version you'd have to change it (and
lose the original) or (worse???) make a copy to do about exactly the
same thing.

With the new version, just change the parameters to the function :)

> However, your solution is very nice. I wanted commend you on a great,
> fleshed-out solution.

Thank you.

> Maybe I'm just old-fashioned, but I would have gone for the simpler
> solution lol.

That's a valid point of vue :)
I tend to try and make functions (the ones I think deserve it) work for
everything you can throw at them.


If I need to make a pivot table next month about something, I just
include "pivot.php" and call the function. Hopefully it will work just
like expected on the first run.

As it stands now, it just needs a bit (a lot) more documentation, either
in comments or in a separate file.

--
Mail to my "From:" address is readable by all at http://www.dodgeit.com/
== ** ## !! ------------------------------------------------ !! ## ** ==
TEXT-ONLY mail to the whole "Reply-To:" address ("My Name" <my@address>)
may bypass my spam filter. If it does, I may reply from another address!

[Back to original 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

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