Guys I need to send emails from php and I already created code for it. Now I wish to store email body text in sql table so I can get body text from there and send emails. I am confused which field type to choose to store html email body text! GCS
If email body will be below 65K in size then use TEXT and if its greater than this, then use MEDIUMTEXT.
Hi guys I am still having problems. I copied html email manually into table but when I tried to edit this field by php file <html> </body> tags don't show in editing. Might be I did not choose right table field type. Please help me? GCS
What field type have you kept? Did you make sure to addslash before using insert / update query from php? It would be great if you can share more details or let us see how it comes up to give better idea of problem..
addslash is a php function which escapes single quotes and backslashes inside content before passing it to mysql queries. You can read more about it here.
Ok, but my question is still there "which field type to choose to store html emails in sql table"? First step is to choose right table field type! GCS
My first response to the thread: What is an estimated size of email?? Without proper analysis how can you decide upon field type? Calculate maximum email size that you may have to store in database. If its above 65K then use TEXT as field type otherwise use MEDIUMTEXT.
My email size is very normal i.e. one html page. I was conscious about field type because why I am not able to get in php form exactly how it is stored in sql table? I thought might be it is because of field type. GCS
In that case keep it as MEDIUMTEXT. For problem that it is not coming proper in php, please check whether it is stored proper in database. If yes, there there could be a php level problem, which we can know if you share more details about it..
It is stored correct in database because emails are being sent perfectly. Right now field_type is longtext. I am just simply storing data from table to php array and then into simple variable and then editing it in php form's TEXTAREA field. GCS
Then it should not be a problem. Without looking at code all i can suggest is to debug it at each stage. After selecting data, simply write the email content in different text files till the time it is displayed on textarea and check whether it is written proper till end. If its written, then there could be other problem..