Firts time user of adodb
| From: | -* Nadine *- | Date: | Tue, 24 Feb 2004 10:14:15 +0000 |
| Subject: | Firts time user of adodb | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-33097@lists.php.net to get a copy of this message | ||
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