新手求解一个奇怪的有关问题(php+odbc+access)
程序员文章站
2024-02-08 13:30:34
...
新手求解一个奇怪的问题(php+odbc+access)
$constr = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" . realpath("ck.mdb");
$linkid = odbc_pconnect($constr,"","",SQL_CUR_USE_ODBC);
$sql="select * from cp20113";
$sqlr=odbc_exec($linkid,$sql);
echo odbc_num_rows($sqlr);
?>
返回的结果是-1,而表cp20113中有几十条记录。不知道哪里出错了,昨天弄到大半夜,晕啊,救救我吧?
------解决方案--------------------
odbc_num_rows() will return the number of rows in an ODBC result. This function will return -1 on error. For INSERT, UPDATE and DELETE statements odbc_num_rows() returns the number of rows affected. For a SELECT clause this can be the number of rows available.
$constr = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" . realpath("ck.mdb");
$linkid = odbc_pconnect($constr,"","",SQL_CUR_USE_ODBC);
$sql="select * from cp20113";
$sqlr=odbc_exec($linkid,$sql);
echo odbc_num_rows($sqlr);
?>
返回的结果是-1,而表cp20113中有几十条记录。不知道哪里出错了,昨天弄到大半夜,晕啊,救救我吧?
------解决方案--------------------
odbc_num_rows() will return the number of rows in an ODBC result. This function will return -1 on error. For INSERT, UPDATE and DELETE statements odbc_num_rows() returns the number of rows affected. For a SELECT clause this can be the number of rows available.
相关文章
相关视频