Re: Syntax Error
- From: Carl Pearson <jman_spam_trap_.org@xxxxxxxxx>
- Date: Sun, 07 Jan 2007 20:07:06 -0600
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"; ???
.
- References:
- Syntax Error
- From: "JD"
- Syntax Error
- Prev by Date: ODBC and long text fields
- Next by Date: Re: [PHP] ODBC and long text fields
- Previous by thread: Re: [PHP] Syntax Error
- Next by thread: ODBC and long text fields
- Index(es):