943,696 Members | Top Members by Rank

Ad:
  • MySQL Discussion Thread
  • Unsolved
  • Views: 15811
  • MySQL RSS
Sep 14th, 2007
0

store HTML is a text field in a table on a MySQL Database

Expand Post »
I am emailing a field from a MySQL DB table. The field type is text. Basically, it is an accept email. How can I make it so the email sent is capable of emailing HTML to make the message more attractive?

I have already tried to insert < html > into the text field, but that doesn't work....The received email, just diplays the text < html > and then the rest of the text.
ANy suggestions?
Reputation Points: 10
Solved Threads: 0
Light Poster
woocha is offline Offline
48 posts
since Dec 2006
Sep 14th, 2007
0

Re: store HTML is a text field in a table on a MySQL Database

The problem was in the PHP code...I needed to add a few steps that were missing the code went from:
MySQL Syntax (Toggle Plain Text)
  1.  
  2. if ($action == "decline")
  3. {
  4. $query = "delete from orders where id=$id and merchant=$merchant";
  5. mysql_query( $query);
  6.  
  7. if ($sendemail == "yes")
  8. {
  9.  
  10. mail("\"$name\" <$email>",
  11. "Your order has been declined!",
  12. stripslashes($r['emaildecline']),
  13. "From: \"".$r['company_name']."\" <".$r['email'].">\nReply-To: ".$r['email']);
  14. }
  15. }

to:
MySQL Syntax (Toggle Plain Text)
  1. $company_name = $r['company_name'];
  2. $company_email = $r['email'];
  3. if ($action == "decline")
  4. {
  5. $query = "delete from orders where id=$id and merchant=$merchant";
  6. mysql_query( $query);
  7. $message = stripslashes($r['emaildecline']);
  8.  
  9. $headers = "MIME-Version: 1.0 \r\n" .
  10. "Content-type: text/html; charset=iso-8859-1\r\n" .
  11. "From: $company_name <$company_email>\r\n" .
  12. "Reply-To: $company_email";
  13. if ($sendemail == "yes")
  14. {
  15. mail("\"$name\" <$email>",
  16. "Your order has been declined!",
  17. $message,
  18. $headers);
  19. }
  20. }

I am only posting this so other people can fix this problem without having to go through what I went throuygh....If you have any questions, reply to this thread
Reputation Points: 10
Solved Threads: 0
Light Poster
woocha is offline Offline
48 posts
since Dec 2006
Mar 5th, 2008
0

Re: store HTML is a text field in a table on a MySQL Database

ummm this is sorta something like this - i think.

Wat I am doing is creating a div overlay website- which basically i am putting the layout code into the mysql database... There are two parts to the code

the about me part which is basically the css of the layout

And the who i'd like to meet part - which is the html code.

My problem is - that i have a php file and to print this code as text - i have used a textarea box - because i need the code to come up into two different text area boxes that way when users click on - it just automatically copies.

My problem is - is that the 2nd set of code which is the html stuff - is printing half of it as text into the box - but the other half the web browser is literally taking as code... so wat do i do? - Do you know what is wrong with it???

Here is my site to see what i am talking about-

http://mydivspot.com/plaincart/index.php?c=24&p=15

Thank you

sandy
Reputation Points: 10
Solved Threads: 0
Newbie Poster
myluvstefan is offline Offline
2 posts
since Mar 2008
Mar 5th, 2008
0

Re: store HTML is a text field in a table on a MySQL Database

Use PHP's htmlspecialchars() function to output the HTML as text. e.g.

MySQL Syntax (Toggle Plain Text)
  1. echo htmlspecialchars("<html></html>");
Reputation Points: 29
Solved Threads: 47
Posting Whiz
mwasif is offline Offline
312 posts
since Dec 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in MySQL Forum Timeline: database query limitations
Next Thread in MySQL Forum Timeline: Myisam and InnoDB





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC