Re: Syntax Error



JD wrote:
Can someone help me figure out why I can't run this on MySQL. I get a syntax error.

list($qh,$num) = dbQuery("SELECT password AS passwd1, $DATABASE_PASSWORD_FUNCTION('$password') AS passwd2 ".

"FROM $USER_TABLE WHERE username='$username'");

$data = dbResult($qh);

You might need to remove the $ from DATABASE_PASSWORD_FUNCTION - that'll make it a variable, not a function. If it is a var, the way you wrote it implies it's returning the name of a field in the table being selected.

If that doesn't work, try

$dbQuery = "SELECT password AS passwd1, " . $DATABASE_PASSWORD_FUNCTION('$password') . " AS passwd2 " .
"FROM " . $USER_TABLE . "WHERE username='" . $username . "'";

list($qh,$num) = dbQuery($dbQuery);

I know, you're *supposed* to be able to embed vars in quoted text, as a matter of personal style I just always like to parse that stuff out.

Just curious, not sure exactly what you're doing with DATABASE_PASSWORD_FUNCTION. Are there two passwords to be retrieved? Why not just say "select password from $TABLE where username = $username"; ???
.