note 102635 rejected from function.odbc-connect by danbrown

[email protected] Fri, 25 Feb 2011 06:32:40 -0800
Newsgroups php.notes
Message-ID <[email protected]>
Note Submitter: kitschkath at hotmail dot com 

----

ca you please help me with these codes? I am making a login page using ms access as the database

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>

<?php
session_start();

$tbl_name="tbllogin";

$connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . realpath("C:\Users\SASHUU\Desktop\troll\DBstudent.mdb").";";
$conn=odbc_connect($connstr,'','')
or die("connect error: ".odbc_error());

// get passed parameters
$username=trim(stripslashes($_POST['username']));
$password=trim(stripslashes($_POST['password']));

$sql="SELECT * FROM $tbllogin WHERE username='$username' and password='$password'";

// prepare and execute in 1 statement
$result=odbc_exec($conn,$stmt)
or die ("result error ".odbc_error().'-'.odbc_errormsg());

// if no result: no rows read
if (!odbc_fetch_row($result))
die("Wrong Username or Password");

// else: all is okay
else {
$_SESSION['username']=$username;
$_SESSION['password']=$password;
header("form.html");
}
odbc_close($conn);
?>
</body>
</html>