From: nagendra prasad on
Hi All,

Is this syntax is correct??

SELECT username FROM data, password FROM registration WHERE username=%s AND
password=%s"


Best,
Guru.
From: Niel Archer on
> Hi All,
>
> Is this syntax is correct??
>
> SELECT username FROM data, password FROM registration WHERE username=%s AND
> password=%s"

No, it is not.
This list is for Windows based PHP matters. You will find far more
knowledgeable people (so more responses) by asking on the appropriate
list, i.e. php-db(a)lists.php.net for database related PHP matters, or an
SQL list/forum for SQL problems.

http://dev.mysql.com/doc/refman/5.1/en/select.html

You seem to be trying to do a JOIN

> Best,
> Guru.

--
Niel Archer


From: Amit Tandon on
SELECT d.username, r.password FROM data join registration r on r.username
= d.username WHERE r.username like '%s' AND
r.password like '%s'"

Presuming the password stored as clear text and username is common field

SELECT d.username, r.password FROM data join registration r on r.username
= d.username WHERE r.username like '%s' AND
r.password like '%s'"

or

SELECT d.username FROM data as d, registration as r WHERE r.username like
'%s' AND
and r.password like '%s'"
and r.username = d.username
============
regds
amit

"The difference between fiction and reality? Fiction has to make sense."


On Sun, Sep 5, 2010 at 6:48 PM, nagendra prasad <nagendra802000(a)gmail.com>wrote:

> Hi All,
>
> Is this syntax is correct??
>
> SELECT username FROM data, password FROM registration WHERE username=%s AND
> password=%s"
>
>
> Best,
> Guru.
>