Re: escaped characters problem

From: Date: Mon, 19 Jun 2000 12:38:00 +0000
Subject: Re: escaped characters problem
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-469@lists.php.net to get a copy of this message
use the functin htmlspecialchars() htmlspecialchars -- Convert special characters to HTML entities. Description string htmlspecialchars(string string); Certain characters have special significance in HTML, and should be represented by HTML entities if they are to preserve their meanings. This function returns a string with these conversions made. This function is useful in preventing user-supplied text from containing HTML markup, such as in a message board or guest book application. At present, the translations that are done are: '&' (ampersand) becomes '&amp;' '"' (double quote) becomes '&quot;' '<' (less than) becomes '&lt;' '>' (greater than) becomes '&gt;' Note that this functions does not translate anything beyond what is listed above. For full entity translation, see htmlentities() in the php manual. Taken from PHP manual Regards Durrani. -- "Lez Lytollis" <Lez.Lytollis@ccr.ntu.ac.uk> wrote in message news:033a01bfd9e8$da5707c0$33974798@mothra... > I have a written a simple news input interface for our admin staff to add > articles to our website. When they have an article name containing a single > quote, the string is cut off at that point on generation of the sql string. > > example > --------- > > original typed entry in description field: Lez's quote test > echoed $description value: Lez\'s quote test > $strsql = "INSERT INTO news (description) VALUES ( '$description' )"; > echoed $strsql value: Lez\ > > Can anyone tell me what is going on and how I can fix it? > > Thanks in advance > > Lez > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.db (#469) next »