Re: Firts time user of adodb
| From: | John Lim | Date: | Tue, 24 Feb 2004 11:22:49 +0000 |
| Subject: | Re: Firts time user of adodb | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-33098@lists.php.net to get a copy of this message | ||
Hi Nadine,
Turn on debugging. Eg.
$db = ADONewConnection('access');
$db->debug = 1;
"-* Nadine *-" <smittenwithsmirnoff@hotmail.com> wrote in message
news:BAY1-F70bQI9hGLdsJH000096ca@hotmail.com...
> Hi
> I'm a new member to the list and using php of rthe first time. I have
> decided to use adodb so I can make a dsn-less connection to an access
> database.
> I have managed to get my script to run without errors but thats all....
I've
> tried using a Select statement but it does nothing...
> here's my code:
>
> <?php
>
> include("adodb/adodb.inc.php"); // includes the adodb library
> $db = ADONewConnection('access');
> $dsn = "Driver={Microsoft Access Driver
>
(*.mdb)};Dbq=http://student.dcu.ie/Project/XtraVision.mdb;Uid=Admin;Pwd=;";
> $db->Connect($dsn);
>
> $sql = "SELECT Surname, City FROM Member";
> $rs = &$db->Execute($sql);
> if (!$rs)
> {
> echo $db->ErrorMsg(); // Displays the error message if no results could be
> returned
> }
> else
> {
> while (!$rs->EOF)
> {
> echo $rs->fields[0].' '.$rs->fields[1].'<BR>'; // fields[0] is
> surname,
> fields[1] is age
> $rs->MoveNext(); // Moves to the next row
> } // end while
> } // end else
>
>
>
> ?>
>
> Thanx in advance :)
>
> _________________________________________________________________
> MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.
> http://join.msn.com/?page=features/virus