Re: Lost data on insert query
| From: | Bob Lutz | Date: | Fri, 18 Aug 2000 02:06:48 +0000 |
| Subject: | Re: Lost data on insert query | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-12393@lists.php.net to get a copy of this message | ||
It may help to debug this by displaying the query string prior to the INSERT,
retrieving the string you just inserted, and seeing where it is terminated.
Ususally it is a result of improperly escaped single or double quotes, or if
you are displaying the text as HTML, you may be misled that the string was
stored incorrectly, when, in fact, the string contained an HTML character
(like < or >) that should have been converted to its HTML equivalent. This
can cause early termination of displayed text. You'll probably need to parse
the string before you store it, or when retrieved, or both.
Bob Lutz
lance@dallypost.com wrote:
> I am writing a script to store outgoing email messages to a
> database. When I insert into the table, it only stores the first one
> and a half sentences or so.
>
> The field that I am trying to insert to is a text type, I have also tried
> long text with no difference.
>
> Can anyone tell me what is going on?
>
> Thanks,
>
> Lance Earl
>
> My code follows:
>
> //post mail to history log
> $notes = "To: ";
> $notes .= $mailto;
> $notes .= "\n\n";
> $notes .= "From: ";
> $notes .= $mailfrom;
> $notes .= "\n\n";
> $notes .= "Subject: ";
> $notes .= $mailsubject;
> $notes .= "\n\n";
> $notes .= $mailbody;
>
> //print("<BR><font color=red size=+2>TEST::notes = $notes
> </font>");//Test Test Test
>
> $query = "insert into history
> set date = now(),
> memberid = $to,
> action = '$action',
> notes = '$notes'";
> $result = mysql_query ($query, $dp);
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net