Reply to Re: ADODB question

Your name:

Reply:


Posted by Erwin Moller on 05/16/07 15:27

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>

Regards,
Erwin Moller

>
> 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'"

[Back to original 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

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