You are here: Re: ADODB question « PHP Programming Language « IT news, forums, messages
Re: ADODB question

Posted by Karin J on 05/17/07 11:24

Erwin Moller wrote:
> Karin J wrote:
>> I am in the process of converting a PHP5 script that talks to an MS
>> SQL db from using ODBC to ADODB. I should say that I have no control
>> over what is installed on the (remote) server. It seems to have some
>> sort of minimal set of ADODB functions, but doesn't (for example)
>> recognise the GetRow() function.
>>
>> Anyway, before, to put the results into an array for further
>> manipulation, I had:
>> $results = odbc_exec($connection_id, $select);
>> while(odbc_fetch_row($results, $rowcount)):
>> $hits[]=array_map('trim', odbc_fetch_array($results, $rowcount));
>> endwhile;
>>
>> now I am trying things like:
>> $results = $conn->execute($select); // (this works, and I can get
>> individual values with: $results->Fields["Variable name"]->Value
>> while (!$results->EOF):
>> $hits[]=array_map('trim', $results->fields );
>> $results->MoveNext();
>> endwhile;
>>
>> but get the error message
>> "array_map() [function.array-map]: Argument #2 should be an array"
>> I thought that $results->fields would be an array? Help!
>
>
> Hi,
>
> In such cases, simply try this:
> <pre>
> <?php print_r($results->fields); ?>
> </pre>

Hi Erwin
This just prints the words "variant Object" !?
Thanks
Karin


>> Many thanks
>>
>> Karin
>>
>>
>> PS
>> I also thought that
>> foreach($results AS $result):
>> ...whatever...
>> endforeach;
>> would work, but this get the error message:
>> "Uncaught exception 'Exception' with message 'Object of type variant
>> did not create an Iterator'

 

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

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