Re: Re: odbc_fetch_into ??
| From: | Analysis & Solutions | Date: | Tue, 02 Jul 2002 14:48:49 +0000 |
| Subject: | Re: Re: odbc_fetch_into ?? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-104926@lists.php.net to get a copy of this message | ||
Scott:
On Tue, Jul 02, 2002 at 10:05:31AM -0400, Scott Fletcher wrote:
> I tried this script and it showed all of the data correctly, so how do I
> make the define variable to work correctly?
>
> > define(CUSTOMER_ID,0);
> > define(CUSTOMER_NAME,1);
> > define(STATE,6);
> >
> > // blah blah blah
> >
> > if (odbc_fetch_row($result))
> > {
> > odbc_fetch_into($result,$user_detail,1);
> > {
> > echo $user_detail[STATE];
> > }
> > }
Why not make life simpler via odbc_fetch_array()? The names of the fields
become the names of the array's keys. Drop the defines() and
odbc_fetch_row() and just do this:
while ( $user_detail = odbc_fetch_array($result) ) {
echo $user_detail['State'];
}
--Dan
--
PHP classes that make web design easier
SQL Solution | Layout Solution | Form Solution
sqlsolution.info | layoutsolution.info | formsolution.info
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409