Re: Correct Way to save HTML code to database

2009-07-15 Thread Jacques

Hi All,

I came right thanks - the problem was the character set being read in
not being utf-8 a simple php mb_convert solved the problem.

Cheers
J

On Jul 15, 9:18 am, Jacques 
wrote:
> Hi There,
>
> I am having a problem saving html code to a MySQL field using the
> saveAll method.
>
> Basically what is happening is that only half of the html is actually
> saved at times depending on the content. At other times it works fine.
> When the body is comprised of text everything works perfectly
> everytime. This tells me that the code is in order for saving etc, the
> problem must be with certain html entities.
>
> The code is extracted from html formatted emails (body).
>
> Being new to ... wait for it ... PHP, CakePHP and MySQL this is a
> challenge as I have googled and yahood and read the manual been
> through the API code and to no avail ...
>
> Humbly I ask for any assistance that anyone may provide, I am not sure
> if I should be running a function against the html prior to saving,
> and then again possibly when I want to display it (important to note
> that I require the original html to be viewed by a user at a later
> stage)
>
> Thanks
> Jacques

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Correct Way to save HTML code to database

2009-07-15 Thread christo

this could be any number of things. Where is the html from? I'd
examine the source first, to make sure that's not the problem. Second,
i'd test out the html that gives you a problem. Where is it cutting
off? Do you run html_entities, or real escape on it before you insert?
If it was an html entity causing mysql to truncate, it probably
wouldn't insert at all, but would instead give you a mysql error.
Unless your field is the wrong type, as people have already mentioned,
in which case you'd get truncated html in your field as you do.



On Jul 15, 12:18 am, Jacques 
wrote:
> Hi There,
>
> I am having a problem saving html code to a MySQL field using the
> saveAll method.
>
> Basically what is happening is that only half of the html is actually
> saved at times depending on the content. At other times it works fine.
> When the body is comprised of text everything works perfectly
> everytime. This tells me that the code is in order for saving etc, the
> problem must be with certain html entities.
>
> The code is extracted from html formatted emails (body).
>
> Being new to ... wait for it ... PHP, CakePHP and MySQL this is a
> challenge as I have googled and yahood and read the manual been
> through the API code and to no avail ...
>
> Humbly I ask for any assistance that anyone may provide, I am not sure
> if I should be running a function against the html prior to saving,
> and then again possibly when I want to display it (important to note
> that I require the original html to be viewed by a user at a later
> stage)
>
> Thanks
> Jacques
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Correct Way to save HTML code to database

2009-07-15 Thread Carlos Gonzalez Lavin
A TEXT type of db field would be a better option for this...

2009/7/15 rich...@home 

>
> "What kind of field are you using to store HTML?"
>
> As your new to MySQL its worth emphasising that text fields with the
> datatype of varchar have a maximum length. Your data may be getting
> truncated as it's too long to fit in the varchar field.
>
> Have you tried increasing the size of the field in the database to a
> larger value?
>
> On Jul 15, 3:30 pm, Piotr Kilczuk  wrote:
> > Hello,
> >
> >
> >
> >
> >
> > > I am having a problem saving html code to a MySQL field using the
> > > saveAll method.
> >
> > > Basically what is happening is that only half of the html is actually
> > > saved at times depending on the content. At other times it works fine.
> > > When the body is comprised of text everything works perfectly
> > > everytime. This tells me that the code is in order for saving etc, the
> > > problem must be with certain html entities.
> >
> > > The code is extracted from html formatted emails (body).
> >
> > > Being new to ... wait for it ... PHP, CakePHP and MySQL this is a
> > > challenge as I have googled and yahood and read the manual been
> > > through the API code and to no avail ...
> >
> > > Humbly I ask for any assistance that anyone may provide, I am not sure
> > > if I should be running a function against the html prior to saving,
> > > and then again possibly when I want to display it (important to note
> > > that I require the original html to be viewed by a user at a later
> > > stage)
> >
> > What kind of field are you using to store HTML?
> >
> > Regards,
> > Piotr
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Correct Way to save HTML code to database

2009-07-15 Thread rich...@home

"What kind of field are you using to store HTML?"

As your new to MySQL its worth emphasising that text fields with the
datatype of varchar have a maximum length. Your data may be getting
truncated as it's too long to fit in the varchar field.

Have you tried increasing the size of the field in the database to a
larger value?

On Jul 15, 3:30 pm, Piotr Kilczuk  wrote:
> Hello,
>
>
>
>
>
> > I am having a problem saving html code to a MySQL field using the
> > saveAll method.
>
> > Basically what is happening is that only half of the html is actually
> > saved at times depending on the content. At other times it works fine.
> > When the body is comprised of text everything works perfectly
> > everytime. This tells me that the code is in order for saving etc, the
> > problem must be with certain html entities.
>
> > The code is extracted from html formatted emails (body).
>
> > Being new to ... wait for it ... PHP, CakePHP and MySQL this is a
> > challenge as I have googled and yahood and read the manual been
> > through the API code and to no avail ...
>
> > Humbly I ask for any assistance that anyone may provide, I am not sure
> > if I should be running a function against the html prior to saving,
> > and then again possibly when I want to display it (important to note
> > that I require the original html to be viewed by a user at a later
> > stage)
>
> What kind of field are you using to store HTML?
>
> Regards,
> Piotr
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Correct Way to save HTML code to database

2009-07-15 Thread Piotr Kilczuk

Hello,

> I am having a problem saving html code to a MySQL field using the
> saveAll method.
>
> Basically what is happening is that only half of the html is actually
> saved at times depending on the content. At other times it works fine.
> When the body is comprised of text everything works perfectly
> everytime. This tells me that the code is in order for saving etc, the
> problem must be with certain html entities.
>
> The code is extracted from html formatted emails (body).
>
> Being new to ... wait for it ... PHP, CakePHP and MySQL this is a
> challenge as I have googled and yahood and read the manual been
> through the API code and to no avail ...
>
> Humbly I ask for any assistance that anyone may provide, I am not sure
> if I should be running a function against the html prior to saving,
> and then again possibly when I want to display it (important to note
> that I require the original html to be viewed by a user at a later
> stage)

What kind of field are you using to store HTML?

Regards,
Piotr

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Correct Way to save HTML code to database

2009-07-15 Thread Jacques

Hi There,

I am having a problem saving html code to a MySQL field using the
saveAll method.

Basically what is happening is that only half of the html is actually
saved at times depending on the content. At other times it works fine.
When the body is comprised of text everything works perfectly
everytime. This tells me that the code is in order for saving etc, the
problem must be with certain html entities.

The code is extracted from html formatted emails (body).

Being new to ... wait for it ... PHP, CakePHP and MySQL this is a
challenge as I have googled and yahood and read the manual been
through the API code and to no avail ...

Humbly I ask for any assistance that anyone may provide, I am not sure
if I should be running a function against the html prior to saving,
and then again possibly when I want to display it (important to note
that I require the original html to be viewed by a user at a later
stage)

Thanks
Jacques


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---