On Wed, April 11, 2007 9:58 pm, Robert Cummings wrote: > The table fields should have been named well enough in the first > place. Some are not fields at all, but calculations, and, yes, I'll have an " AS foo" in my SQL (only not really foo, of course) simply for documentation purposes, even though I'm not using _assoc, because I want to know what the heck that calculation is a month later. > If you don't want the baggage or you're using the variable so much > that > it warrants an elimination of array access overhead then why not use > the > more concise extract()? > > <?php > > extract( mysql_fetch_assoc() ) > > ?> [shudder] I amy not *want* the exact same name as the table fields in every case, if I have the same name in the SQL in two tables. And, yes, I could use even more " AS foo " (only not foo) a whole lot more... But, really, something like: select id, name from option_list_foo order by rank select id, name from option_list_bar order by rank select id, name from option_list_baz order by rank . . . for a bunch of User Profile popups, I don't really want to have to do a bunch of AS and then an extract, and rely on remembering the AS from section to section. For some reason, I do much better at remembering PHP variable names than SQL column AS names. > Yes, yes, I know some idiot out there will clobber their vars *lol* -- > or not clobber their vars as necessary *grin*. Either way, list()'ing > out all the fields you've already declared in the query (or that are > implied) or directly pulling out to a var using assignment is just > code > in two places that could be in one. You see it as the same thing in two places. I see it as two different things being matched up in a clear unequivocal manner, to make self-documenting code. [shrug] -- 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