Re: Is this syntax is correct?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux