Using COM in PHP4 (ADO)

From: Date: Wed, 07 Jun 2000 18:20:25 +0000
Subject: Using COM in PHP4 (ADO)
Groups: php.general 
Request: Send a blank email to php-general+get-1239@lists.php.net to get a copy of this message
Hi everybody, I've tried to use ADO (ActiveX Data Objects) through COM in PHP4. At the first step it works very well: <?php $adoConn = new COM("ADODB.Connection"); echo "ADO Version: " . $adoConn->Version; define(CSTR, "Driver={Microsoft Access Driver (*.mdb)};DBQ=Auction.mdb"); $intConn = $adoConn->Open(CSTR, 2); if ($adoConn->State == 1) { echo "<br>Connection successfully open:<br>"; $adoRS = $adoConn->Execute("SELECT * FROM address", &$records); echo $adoConn->ConnectionString; echo "<br>" . $records . " Records found"; } ?> The connection works so far. The following code gives all column names of the Access-table and there size (works well): <?php for($i = 0; $i < $adoRS->fields->count - 1; $i++): echo $adoRS->fields[$i]->name . "<br>"; echo $adoRS->fields[$i]->DefinedSize . " Byte max.<br>"; endfor; ?> And following sequence should go through the records: <?php while (!$rs->eof): for($i = 0; $i < $rs->fields->count - 1; $i++): echo $rs->fields->item[$i]; endfor; $rs->movenext; endwhile; ?> But the method "item" is not defined PHP replied. I've tried dozens of variants to catch the content of a field. No way -> it seems that the COM-Interface has problems to translate the collection-structure often used in ADO. I've also tried the com_prop and all other "alternative" functions in PHP available - same result. Here the errors: Warning: PropGet() failed Warning: Invoke() failed This happens only with objects containing records (data), all properties with static values work well. Any hints, suggestions, ideas from the experts here? Jörg Krause ****************************** Mail: joerg@krause.net Info: www.joerg.krause.net ******************************

« previous php.general (#1239) next »