Is this a good idea?
- From: sam.s.kong@xxxxxxxxx
- Date: 17 Jan 2006 09:56:09 -0800
Hi!
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?
TIA.
Sam
.
- Follow-Ups:
- Re: Is this a good idea?
- From: sam . s . kong
- Re: Is this a good idea?
- From: R. Rajesh Jeba Anbiah
- Re: Is this a good idea?
- From: Iván Sánchez Ortega
- Re: Is this a good idea?
- From: Chung Leong
- Re: Is this a good idea?
- From: sam . s . kong
- Re: Is this a good idea?
- From: Pedro Graca
- Re: Is this a good idea?
- From: Andy Hassall
- Re: Is this a good idea?
- Prev by Date: Re: Testing the presence of a given cookie
- Next by Date: FormatDateTime Revisited
- Previous by thread: How would I get the dates from the previous wednesday to the last tuesday?
- Next by thread: Re: Is this a good idea?
- Index(es):
Relevant Pages
|