You are here: Re: MYSQL input data with double-quotes « PHP SQL « IT news, forums, messages
Re: MYSQL input data with double-quotes

Posted by Robert on 03/29/06 05:32

OOPS! Never mind, I finally figured it out. Nothing wrong with that code, it
was some other code.

Sorry for the bother,
Robert the novice

"Robert" <nospam@spamfree.com> wrote in message
news:EJkWf.34631$1Z5.26003@tornado.texas.rr.com...
> This one really has me stumped.
>
> I need to add or update a mysql table with a string that includes double
> quotes. I use the addslashes() function to set the necessary escapes. This
> works with INSERT. However, with UPDATE the string is truncated at the
> first double-quote. (No problem with single-puote.)
>
> This code works, no problem:
>
> $line1=$_POST['item1'];
> $line1=addslashes($line1);
> mysql_query("INSERT INTO $tablename (info) VALUES('$line1') ") or
> die(mysql_error());
>
> With this code, the string is truncated when a double-quote is
> encountered.
>
> $title1=$_POST['T1'];
> $title1=addslashes($title1);
> mysql_query("UPDATE $tablename SET info='$title1' WHERE id='1' ") or
> die(mysql_error());
>
> I would be very grateful for any explanation of this problem
>
> Thanks, Robert
>
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация