You are here: Re: Is this a good idea? « PHP Programming Language « IT news, forums, messages
Re: Is this a good idea?

Posted by sam.s.kong on 09/27/77 11:37

Andy Hassall wrote:
> On 17 Jan 2006 09:56:09 -0800, sam.s.kong@gmail.com wrote:
>
> >I've been programming ASP for 5 years and am now learning PHP.
> >In ASP, you can use GetRows function which returns 2 by 2 array of
> >Recordset.
> >Actually, it's a recommended way in ASP when you access DB as it
> >disconnects the DB earlier.
> >Also, it's handy as you can directly access any data in the array
> >without looping.
> >
> >As far as I know, there's no such function in PHP and I can make one.
> >My question is whether it's good in PHP.
> >
> >pseudo-code:
> >
> >$data = get_data("select * from table1");
> >$var = $data[3][2]; //value at 4th row, 3rd column
> >
> >This way, I can wrap db connection, data retrieval, and error handling
> >with one function (or maybe a class).
> >Is the idea workable?
>
> Rather than re-invent the wheel, look at:
>
> http://adodb.sourceforge.net/
> http://phplens.com/adodb/reference.functions.getarray.html

Thanks for the answer.
My intention is not to use ADO db but make DB-accessing code simple and
avoid repeated codes (connecting/freeing/disconnecting db).
Is there a best practice of db-accessing in PHP?

Regards,
Sam

 

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

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