Re: ODBC with MS Access97
| From: | Srinivasan Ramakrishnan | Date: | Tue, 17 Oct 2000 01:15:31 +0000 |
| Subject: | Re: ODBC with MS Access97 | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-20493@lists.php.net to get a copy of this message | ||
Hi,
The code doesn't use $. I'm sorry I made a typo in the question by adding
the $, but as u can see in
the code, I'm not using any $. Moreover I've not added any error handling
code since this is a test.
-Srini
----- Original Message -----
From: Matthias Endler <endler@upsys.de>
To: PHP-GENERAL <php-general@lists.php.net>
Sent: Tuesday, October 17, 2000 6:25 AM
Subject: RE: [PHP] ODBC with MS Access97
> 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
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>