RE: [PHP] ODBC with MS Access97
| From: | Matthias Endler | Date: | Tue, 17 Oct 2000 00:55:40 +0000 |
| Subject: | RE: [PHP] ODBC with MS Access97 | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-20491@lists.php.net to get a copy of this message | ||
Hi,
> I'm trying to connect to an MS Access 97 database using ODBC.
> When I try to
> loop thru the rows I get a function undefined error for the functions
> $odbc_num_fields() and $odbc_result().
^ ^
leave away the $ and everything should work fine :)
<?
$db_conn_id = odbc_connect("MS Access 97 Database","","");
$sql = "SELECT name.* FROM name";
$result_id = odbc_exec($db_conn_id,$sql);
$num_cols = odbc_num_fields($result_id);
/*$num_cols = 3; #inserted since I am getting an error in the line above
// Ouch, comments badly nested in the line above...
echo "<table>";
while(odbc_fetch_row($result_id)){
echo "<tr>";
for($i=1;$i <= $num_cols;$i++){
echo ("<td>".odbc_result($result_id,$i)."</td>");
// getting an error here too.... not anymore
}
echo "</tr>";
}
echo "</table>";*/
$exec_db = odbc_result_all($result_id);
odbc_close($db_conn_id);
?>
Cheers,
Matthias