When you say "wrong password", are you talking about a message you're
returning or a CF database connectivity error because you don't have
privileges to access the database?
Can you run any query against that db?
The query doesn't seem to be joining any records; what happens when you run
this query with specific values? Don't you need something like "AND
messages.from_email = members.email" ?
A simpler(?), better(?) query might be
SELECT email
FROM members
WHERE email = '#form.email#'
AND password = '#form.password#'
AND email =
(SELECT from_email
FROM messages
WHERE mID = #form.mID#)
I'm assuming each message has only one from_email associated with it. This
query will return 1 record if the members.email and members.password are
valid AND the messages.from_email for that mID equals the email in the
members table.
-----Original Message-----
From: W Luke [mailto:[EMAIL PROTECTED]]
Sent: Friday, September 29, 2000 4:07 PM
To: CF-Talk
Subject: Query Advise
Hi,
For me, SQL is either thoroughly straightforward, or bizarrely confusing.
As soon as I try to do something remotely complicated, I run into trouble,
simply cannot work it out, and come to you guys. As well as advising me how
to fix my latest Query - can anyone tell me of a decent SQL website for
advanced queries, or a book? I'd be really grateful.
OK the query in question is as follows:
<cfquery name="checkuser" datasource=#ds#>
SELECT mID,from_email,email,password FROM messages,members WHERE
messages.mID = #form.ID# AND messages.from_email = '#form.email#' AND
members.password = '#form.password#' AND members.email = '#form.email#'
</cfquery>
mID and from_email are fields in the "messages" table. Password and email
are fields in the members Table. mID is originally set from a url variable,
and for example might be set to 5. This would return an email address
'from_email' - what I need to do is validate this email against one stored
in members, check the pass, and if all is OK then move on.
I've spent the whole day on this, on and off, and still it's saying "wrong
password"!
Advise much appreciated..
Cheers
Will
----------------------------------------------------------------------------
--
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.