Re: Is this syntax is correct?

From: Date: Mon, 06 Sep 2010 15:11:59 +0000
Subject: Re: Is this syntax is correct?
References: 1 2  Groups: php.db 
Request: Send a blank email to php-db+get-47366@lists.php.net to get a copy of this message
Amit Tandon wrote:
SELECT d.username, r.password FROM data join registration r on r.username
SELECT username FROM data, password FROM registration WHERE username=%s AND password=%s"
Oh, boy -- "r on r"?? Obviously the guy is a rookie. Let's be simple: SELECT data.username,registration.password FROM data inner join registration ON data.<linking_field> = registration.<linking_field> WHERE username=%s AND password=%s" <linking_field> is the name of the common field in each table, such as "user_id". Comments: 1. "data" is a really bad name for a table. You will confuse the heck out of yourself and others who follow you. Change it. 2. As Amit kind of said, no password should be stored in a table (available on a web server) without encrypting the password information. Ken

« previous php.db (#47366) next »