Re: Posting a variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, April 11, 2007 8:17 pm, Robert Cummings wrote:
> I'd rather lose track of $row['foozie'] than $row[1]. Either way, if
> your code is structured well, the row data should be in close
> proximity
> to it's use. At the very least, if your field names are informative
> instead of 'foozie', maybe 'email' then I think you'll have less
> trouble
> remembering. This isn't really a religious issue... it's a clarity
> issue. I mean, why bother naming variables if you think you might get
> confused later. Just call your vars $foo1 to $fooX-- at least that's
> the
> path you've laid out as an argument.

But I don't USE row[1]!

And certainly not $foozie!  I would have hoped that was obvious, but I
guess not. :-(

I use $email and I have it "close" enough to the source query, and
with the name matching up (for simple columns) or very clear and
descriptive names for calculated SQL values.

I might do an aggregate count(*) with a group by and it's going to be
called $count, if it's simple enough a script to remember what is
being counted, since there is only one thing being counted.

If I have both venues and cities being counted, it's $venue_count and
$city_count.

I don't really like carrying around the "baggage" of
$row['venue_count'] everywhere, especially if I'll use the variable a
lot.

If I'm going to assign it to a well-named variable in 3 lines anyway,
wny do I need it to be in an assoc array?  I don't.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux