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'" 3 3673
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'"
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'
Karin J wrote:
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
Hi Karin,
Well, so you just proved PHP was complaining correctly it was not an array.
If you are using COM objects, you are NOT using real PHP.
So you must solve your problems inside your COM object's API.
I cannot help there: it was many years ago since I last used that approach.
Sorry.
Good luck,
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'
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: David Gray |
last post by:
Greetings all,
How can I use ADODB to return all tables in an access DB chosen by the
user?
I'm able so far to select the DB file and build up my connect string,
but I would like to offer a...
|
by: Simone |
last post by:
Hello
I hope you guys can help me. I am very new to ADO...
I am creating a ADODB connection in a module and trying to access it
from a command button in a form.
Function fxEIDAssgn(plngEID As...
|
by: Ivan Sammut |
last post by:
Hi,
I am a rookie and trying to use the ADODB recordset.
I got the hang on how ot open a table and navigate thru it.
The only question I have is that currently I am using a kind of field Index...
|
by: ASP.Confused |
last post by:
The old message looked a little stale, so I am re-posting it here. Anybody
have any ideas of what I could do?!? The previous responses to this
question are below. If you want to look at the...
|
by: Ames111 |
last post by:
Hi
I have an application that connects to a SQl database on my computer
via an ADODB connection:
ADODB.Connection Conn = new ADODB.Connection();
Conn.ConnectionString = ("Driver={SQL...
|
by: Yuk Tang |
last post by:
I'm trying to grab the fieldnames and values from a recordset, but
I'm getting errors. I have an idea what the error might come from,
but I'm not sure how to correct it.
I'm connecting to an...
|
by: Tom |
last post by:
I'm interested in adopting ADOdb (actually ADOdb Lite) and have a
simple question that I haven't been able to quite pinpoint an answer
to.
I'm used to using the native mysql functions with...
|
by: Peter Newman |
last post by:
Im still trying to get my head around this, but its the only way i have seen
to be able to create a 'recordset' and bind text boxex to it and navigate
throw each record by the click of a button ......
|
by: Aleks Kleyn |
last post by:
At this time my code use ODBC and adodb to access database. Working with win
vista i discovered that way i cannot work with SQL server. it is not clear
this is bug or Microsoft suppose to give...
|
by: muriwai |
last post by:
Hi,
I have a C# assembly project under Visual Stuio 2008 Pro on Windows Server
2008. I converted the project from VS 2005.
The project references COM->Microsoft CDO for Windows 2000 Library...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |