You are here: Re: am I doing unnecessary operations by mysql_fetch_array? « PHP Programming Language « IT news, forums, messages
Re: am I doing unnecessary operations by mysql_fetch_array?

Posted by C. on 08/07/07 08:33

On 4 Aug, 18:44, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> David Gillen wrote:
> > Jerry Stuckle said:
> >> David Gillen wrote:
> >>> Gary L Burnore said:
> >>>> I'm thinking he's not having this discussion in comp.databases.mysql
> >>>> because he knows what the response will be. He was hoping he wouldn't
> >>>> get the same response here. :)
> >>> The discussion is being had here because it follows on from a question asked.
> >>> I've also yet to see a valid reason as to why select * shouldn't be used on a
> >>> single table query when you want all fields from that table other than
> >>> 1) you can't depend on the order of the fields return. Which is irrelevant if
> >>> you write your code so that you need not be concerned with that.
> >>> 2) vague rumbling about the mysql team advising against it, although I'm
> >>> having difficulting finding that on the mysql site, and I'm guessing this
> >>> really relates to complex joins and the order of returned results. Both of
> >>> which do not affect the situation I posed.
>
> >>> D.
> >> Just because it's a follow on question doesn't mean it should be here.
>
> >> You'll get much better answers in comp.databases.mysql - where all the
> >> people are MySQL users, and some of the MySQL development team hang out.
>
> > I didn't pose the original question. Also it's peoples php code where the
> > problem seems to lie, i.e. in the code being unable to handle changing of the
> > order of the columns.
>
> > D.
>
> Nope, its ANY code, not just PHP.
>
> And NOTHING in the last 20-30 posts in this thread have ANYTHING to do
> with PHP. It's been all MySQL.
>
> Please take this somewhere appropriate. It is no longer appropriate to
> this newsgroup.
>

I disagree - it's generically about programming - one thing I missed
in my previous post is that if there is a join it could give rise to
column naming being ambiguous (I don't have an env to hand to test it
- what happens if both tables have a column called 'description'?).
But this was outwith the scope of the original post.

As other people have hinted, using mysql_fetch_array (or any function
which assigns manufactured keys to an array) instead of
mysql_fetch_assoc (or any function which uses intrinsic keys) is just
plain bad programming.

Micha wrote:
> http://dev.mysql.com/doc/refman/5.1/en/change-column-order.html

relying on sequence within columns is not the way to solve the
problem. Nor can you rely on row sequence without explicit ordering in
the query.

C.

 

Navigation:

[Reply to this 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

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