11-21-2007, 02:36 PM
|
#8 (permalink)
|
|
The Prestige
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
|
Quote:
Originally Posted by Salathe
I don't know why you're using parentheses and the && comparison operator. Why not just go the normal route?
sql Code:
--- Compare SELECT a FROM b WHERE ((c = 'c') && (d = 'd')) LIMIT 1 --- With SELECT a FROM b WHERE c = 'c' AND d = 'd' LIMIT 1
Also, since you're using sprintf, why are you concatenating the table/column names into the formatting string?! Make proper use of the function, or don't use it at all, rather than mixing and matching.
(Use back ticks to wrap table and column names if you want/need to)
php Code:
$szSql = sprintf("SELECT %s FROM %s WHERE %s = '%s' AND %s = '%s' LIMIT 1", $this-> db-> col[ 'user_id'], $this-> db-> table[ 'users'], $this-> db-> col[ 'username'] $user_name, $this-> db-> col[ 'user_pass'], md5($user_pass));
|
Well, as I said, the SQL QUERY was from a tutorial that I was reading, I just copy pasted it, because I was confused about the md5 thing.
Anyways, I don't know why i do that :| I'll edit it ;)
THanks :)
|
|
|
|