PHP and MS Access: Number of Records returned by SELECT query
Posted
by VarunGupta
on Stack Overflow
See other posts from Stack Overflow
or by VarunGupta
Published on 2008-09-24T11:04:46Z
Indexed on
2010/03/17
14:31 UTC
Read the original article
Hit count: 267
I am running following PHP code to interact with a MS Access database.
$odbc_con = new COM("ADODB.Connection");
$constr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . $db_path . ";";
$odbc_con -> open($constr);
$rs_select = $odbc_con -> execute ("SELECT * FROM Main");
Using ($rs_select -> RecordCount) gives -1 though the query is returning non-zero records.
(a) What can be the reason? (b) Is there any way out?
I have also tried using count($rs_select -> GetRows())
. This satisfies the need but looks inefficient as it will involve copying of all the records into an array first.
© Stack Overflow or respective owner