|
Posted by David Grant on 01/10/06 19:13
Jochem,
Jochem Maas wrote:
> David Grant wrote:
> 1. your looping a result set which involves a db connection - lots
> of pontential things that could go wrong...
Absolutely, and lots of lessons to learn too.
> 2. its not a centralized 'solution' - code reuse is a good thing.
However, what use is code reuse when you're using it only once. If you
need to perform the same function again, then refactor the existing code.
> 3. we should encourage people to aim a little higher?
I imagine my first PHP script with a database connection probably looked
much like Adrian's solution, and writing lots and lots of PHP has taught
be some best practices that I now stick to. However, being told that I
need to write reusable functions for iterating a resultset would've had
me running off to another scripting language in a heartbeat.
Tell people to aim higher, sure, but let them make their own mind up,
make their own mistakes and learn from them. :)
>>
>> Even the longest journeys start with small steps, and asking someone new
>> to PHP to separate various tiers might put them off.
>
> which I could spin as a positive thing - raising the lowest commom
> denominator
> so to speak. besides Sue was the one that came with the many-in-one
> question
> (i.e. how to a dynamically generate a select box AND how do I grab data
> from
> a DB).
I'm sure you're not being elitist, but where do you place the bar?
Should PHP be made a language that only the experienced can get into?
That sounds like a policy that would only harm the PHP community.
David
--
David Grant
http://www.grant.org.uk/
[Back to original message]
|