PHP adodb - what is wrong

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sanv
Forum Newbie
Posts: 12
Joined: Thu Nov 01, 2007 12:43 pm

PHP adodb - what is wrong

Post by sanv »

hey,

i am trying to make a connection to a MS access database using adodb with the following code:

Code: Select all

$conn = new COM("ADODB.Connection");
	
	try
	{
		$conn->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=".realpath("bla.mdb").";");
		$rs = new COM("ADODB.Recordset");
		$rs->Open("SELECT us, ps FROM users", $conn, 0, 1);
	
		while(!$rs->EOF) 
		{ 
			if(($usrname == $rs->Fields('us')->value) && ($pwd == $rs->Fields('ps')->value))
			{
				$rs->Close();
				$conn->Close();
				$rs = null;
				$conn = null;
				header('Location: test.php');
				exit();
			}
			$rs->MoveNext();
		} 
		
		$rs->Close();
		$conn->Close();
		$rs = null;
		$conn = null;
		header('Location: index.php');
		exit();
	} 
	catch( Exception $exception ) 
	{
		die("database error");
	}
I get the following error message:

Parse error: syntax error, unexpected '{' in test.php on line 8

Thanks for the forthcoming help
Post Reply