FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » ODBC Connection
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: ODBC Connection [message #172745 is a reply to message #172735] Sun, 27 February 2011 20:46 Go to previous messageGo to previous message
bruceaj is currently offline  bruceaj
Messages: 30
Registered: September 2010
Karma:
Member
On Feb 27, 1:54 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> On 2/27/2011 1:24 PM, bruceaj wrote:
>
>
>
>> On Feb 27, 1:07 pm, Luuk<L...@invalid.lan>  wrote:
>>> On 27-02-11 18:57, bruceaj wrote:
>
>>>> I am connecting to an MS Access database. The connection and exec work
>>>> fine. My problem is getting the data.
>
>>>> The following two statement work;
>>>> $row = odbc_fetch_array($rs);
>>>> $value = $row['Newspaper'];
>
>>>> If I change to
>>>> $value = $row[1];
>
>>>> is_null($value) returns true.
>
>>>> What am I doing wrong or is an idiosyncrasy of using MS Access?
>
>>>> Bruce
>
>>> This would probably tell more:
>>> print_r($row);
>
>>> --
>>> Luuk
>
>> Okay.. Thanks for the response.
>
>> Array ( [Newspaper] =>  Review [Year] =>  1887 [Month] =>  5 [Day] =>  20
>> [Page] =>  4 [Column] =>  3 [Father First] =>  Joe [Father Middle] =>
>> [Mother First] =>  [Mother Middle] =>  [Mother Maiden] =>  [First] =>
>> Daughter [Middle] =>  [Last] =>  Allen [Date Of Birth] =>  05/18/1887
>> [Date Of Baptism] =>  [Church] =>  [Counter] =>  1 [NewspaperKey] =>  1
>> [Comments] =>  )
>
>> Hope this helps..
>
>> Thanks again.
>
>> Bruce
>
> Which is exactly what you should get if you fetch as an associative
> array.  If you want to access the values by index, you need to fetch
> with an indexed array (odbc_fetch_row())/
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstuck...@attglobal.net
> ==================

Okay.. obdc_fetch_row() seems to have worked. I was under the opinion
that with an Associative Array the item could be addressed via either
a name or an index. I guess I'm wrong. Apparently an Associative Array
can only be indexed via a string value. Strange...

Thanks...

Bruce
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: static vs global variable
Next Topic: SOCIAL NETWORK FOR PHP PLATFORM..
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 18:45:23 GMT 2024

Total time taken to generate the page: 0.04197 seconds