Hi, I wonder If somebody has experience this or could point me in the
right direction:
I have the following script (commented out just to use the username):
// Check username and password
// Assume you have a valid DB handler ($dbh) already connected
$result = false;
if ( isset($_POST['username']) && isset($_POST['password']) ) {
$username = $_POST['username'];
// $password = $_POST['password'];
echo "username: $username<br>\n ";
//echo "password: $password<br>\n ";
$result =& $dbh->query($WEBAPP_ LOGIN_SQL, $username);
if (PEAR::isError( $result)) {
echo "An error occurred while trying to execute the
following
query:<br>\n";
echo "$WEBAPP_LOGIN_ SQL<br>\n";
echo "Error message: " . $result->getMessage() . "<br>\n";
echo "A more detailed error description: " . $result-
exit();
}
}
The query in the global variable $WEBAPP_LOGIN_S QL is:
$WEBAPP_LOGIN_S QL = "select UserKey from [User] where UserName = ?";
Unfortunately I get the following output:
username: lll
An error occurred while trying to execute the following query:
select UserKey from [User] where UserName = ?
Error message: MDB2 Error: syntax error
A more detailed error description: _doQuery: [Error message: Could not
execute statement] [Last executed query: select UserKey from [User]
where UserName = ?] [Native code: 102] [Native message: Incorrect
syntax near '?'.]
I tried also passing an array as the second argument to the query
method but I get the same result.
I will appreciate any useful feedback.
Thanks.
right direction:
I have the following script (commented out just to use the username):
// Check username and password
// Assume you have a valid DB handler ($dbh) already connected
$result = false;
if ( isset($_POST['username']) && isset($_POST['password']) ) {
$username = $_POST['username'];
// $password = $_POST['password'];
echo "username: $username<br>\n ";
//echo "password: $password<br>\n ";
$result =& $dbh->query($WEBAPP_ LOGIN_SQL, $username);
if (PEAR::isError( $result)) {
echo "An error occurred while trying to execute the
following
query:<br>\n";
echo "$WEBAPP_LOGIN_ SQL<br>\n";
echo "Error message: " . $result->getMessage() . "<br>\n";
echo "A more detailed error description: " . $result-
>getDebugInfo () . "<br>\n";
}
}
The query in the global variable $WEBAPP_LOGIN_S QL is:
$WEBAPP_LOGIN_S QL = "select UserKey from [User] where UserName = ?";
Unfortunately I get the following output:
username: lll
An error occurred while trying to execute the following query:
select UserKey from [User] where UserName = ?
Error message: MDB2 Error: syntax error
A more detailed error description: _doQuery: [Error message: Could not
execute statement] [Last executed query: select UserKey from [User]
where UserName = ?] [Native code: 102] [Native message: Incorrect
syntax near '?'.]
I tried also passing an array as the second argument to the query
method but I get the same result.
I will appreciate any useful feedback.
Thanks.
Comment