lammy
Posts: 49
|
| Posted: 03/04/2005, 1:26 PM |
|
I am having a bit of trouble getting the code below to work, could somebody kindly fill in the blank section. I want to forward a password onto the email address in $to but need to obtain it from the database. this code is situated in the onclick event of the submit button
//Send Email @233-06488961
global $forpassword;
global $DBdatabase;
ini_set("SMTP", "****.****.****.co.uk");
$to = $forpassword->passwordsearch->GetText();
$subject = "Password Reminder";
$forpassword->member_password->SetValue(CCDLookUp("member_password", "members", "email=" THE BLANK SECTION $DBdatabase));
$message = $forpassword->member_password->GetText();
$from = "Administration";
$additional_headers = "From: $from\nReply-To: $from\nContent-Type: text/html";
mail ($to, $subject, $message, $additional_headers);
ini_restore("SMTP");
//End Send Email
|
 |
 |
peterr
Posts: 5971
|
| Posted: 03/04/2005, 2:58 PM |
|
Something like this might work:
$forpassword->member_password->SetValue(CCDLookUp("member_password", "members", "email=" . $to ,$DBdatabase));
If it doesn't work you may want to try printing couple of the values to check which one might be blank, like:
echo $to;
echo CCDLookUp("member_password", "members", "email=" . $to ,$DBdatabase);
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
lammy
Posts: 49
|
| Posted: 03/04/2005, 11:59 PM |
|
Thanks for the reply, I actually now get this error which I havent had before.
using echo all fields where correct
cheers
Database error: Invalid SQL: SELECT member_password FROM members WHERE email=ilammas@ntlworld.com
MySQL Error: 1064 (You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '@ntlworld.com' at line 1)
Session halted.
|
 |
 |
DonB
|
| Posted: 03/05/2005, 6:01 AM |
|
You are not enclosing the string in quotes (the email address in your
WHERE).
--
DonB
http://www.gotodon.com/ccbth
|
|
|
 |
peterr
Posts: 5971
|
| Posted: 03/05/2005, 10:18 AM |
|
Yeah, that was my mistake. The code may need to be:
$forpassword->member_password->SetValue(CCDLookUp("member_password", "members", "email='" . $to ."'" ,$DBdatabase));
or
$forpassword->member_password->SetValue(CCDLookUp("member_password", "members", "email=" . $DBdatabase->ToSQL($to, ccsText) ,$DBdatabase));
I didn't test it, so you may need to resolve such minor issues when testing.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
|