TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Absolute Beginners (http://www.talkphp.com/absolute-beginners/)
-   -   Escaping Commas from a string (http://www.talkphp.com/absolute-beginners/6079-escaping-commas-string.html)

captainmerton 01-04-2012 06:53 PM

Escaping Commas from a string
 
I am reading info from a databse for display in html. Issue i have is sometimes the info might have commas in its for example its may say something like:

Bob's New House

Or

Bob's "New" House

When i display in the html its obviously causing issues. I am wondering what the neatest way to handle this is? Assume i can just preg replace " or ' with " but is this the best way to do it for all display in html? Are there other characters ought to cater for and are there any standard php functions to handle this scenario?

Cheers,
Ewan

maeltar 01-05-2012 08:15 AM

Have a look here..

http://php.net/manual/en/function.htmlentities.php

captainmerton 01-05-2012 07:56 PM

That worked perfectly Simon. Cheers.

maeltar 01-06-2012 07:35 AM

Anytime :D


All times are GMT. The time now is 02:19 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0