[nycphp-talk] best practice for calling multiple queries?
Kristina Anderson
ka at kacomputerconsulting.com
Wed Apr 2 16:49:40 EDT 2008
Dan,
That's how it got introduced for sure...I copy the $result line and
then just increment the numbers [but forgot to increment the number of
the query I was executing]...NOT going to do that any more... !
> Hi Kristina:
>
> On Wed, Apr 02, 2008 at 08:49:08AM -0700, Kristina Anderson wrote:
> > I name each query $query1,
> > query2, etc rather than what I see in a lot of PHP code I've
inherited,
> > where each query is simply named $query, even if there are 6 or 7
of
> > them on the page.
>
> I use $sql for all queries. It's short and to the point. Plus it
> ensures you're running the most recenlty defined $sql and are not
adding
> overhead with extra variables. It also allows you to copy and paste
the
> actual query execution line over and over and over without having to
> worry (which is probably how your bug got introduced).
>
> Even if you want to give each query string a unique variable name,
don't
> name them 1, 2, 3. Give them real names that descirbe what they are.
>
> --Dan
>
> --
> T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
> data intensive web and database programming
> http://www.AnalysisAndSolutions.com/
> 4015 7th Ave #4, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
>
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php
>
>
More information about the talk
mailing list