I having troubling with query. The script process the login form. When enter dave for merchant login and 123njit for merchant password, but it printed out "Merchant login not found in database" I check my table in the oracle, and found that dave and 123njit are in the table. So I don't know why i printed the else statement message even the the in the enter login and password are found in the merchant table. Can anybody help me on this, everything look okay.
<?php
include ("header.php");
// Set Oracle Enviroment
PutEnv("ORACLE_SID=course");
PutEnv("ORACLE_HOME=/afs/cad/solaris/oraclient10.2");
PutEnv("LD_LIBRARY_PATH=/afs/cad/solaris/oraclient10.2/lib");
// Connect to Oracle
$conn = OCI_Connect("user", "pass", "course");
$query = ociparse($conn, "SELECT * FROM MERCHANT WHERE login = :name AND m_pass := pass");
$stmt = OCIParse($conn, $stmt);
$name = $_GET['user'];
$pass = $_GET['pass'];
// bind the input and output variable
ocibindbyname($stmt, ':name', $name, -1);
ocibindbyname($stmt, ':pass', $pass, -1);
OCIExecute($stmt);
$rows = ocifetchstatement($stmt, $result);
// if there is a match
if ($rows > 0)
{
print "Merchant login is valid";
}
else
{
print "Merchant login is not in the database";
}
OCIFreestatement($stmt);
OCILogoff($conn);
?>
</body>
</html>