Jump to content

Sending an email with address from MySQL database


BigDon

Recommended Posts

Hi folks,

 

I just found this group and joined up!

 

I have encountered a problem that I am not sure how to resolve, and I hope someone can assist.

 

I run this query against my MySQL database:

 

mysql_select_db($database_commdb, $commdb);

$query_rsEmailAddress = "SELECT admin_email FROM tbl_admins WHERE admin_id = 1";

$rsEmailAddress = mysql_query($query_rsEmailAddress, $commdb) or die(mysql_error());

$row_rsEmailAddress = mysql_fetch_assoc($rsEmailAddress);

$totalRows_rsEmailAddress = mysql_num_rows($rsEmailAddress);

 

...and want to use the result to populate the "mail to" field for my response form. (I'm doing this to avoid having my email address posted in a page to be skimmed.) I presently use this:

 

$to = rsEmailAddress['admin_email'];

 

I do some empty fields checking before submitting the form. However, when I click on submit, my form, tells me I have empty fields and will not process when there are NO empty fields.  HOWEVER, if I hard-code my email address in the variable "$to" all is well, the form processes correctly, I get the email, etc...

 

So I suspect the problem lies somewhere in the way I have constructed the $to variable. I have scratched my head till I am going bald(er) and my scalp is bleeding!!! HELP!! Please!!  :'(

:D

 

DUDE!  You're a genius!  It works like it is supposed to.

 

I had looked and looked and looked at the code and kept missing the really obvious... Guess I looked at it too much, huh???

 

Thanks for the help and the really quick response.

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.