|
Posted by Karin J on 05/16/07 11:11
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!
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]
|