mysql - PHP halts output of data on apostrophe -


i wrote php script pulls data database , displays in xml format. reason halts output when gets apostrophe in data. select statement, , simple 1 @ that, don't understand why there issues apostrophes or quotation marks. i've tried using addslashes() , mysql_real_escape_string(), though understanding sanitizing data being inserted database, , did not help. i'm stumped. below code , in advance advice!

<? if($result = $mysqli->query("select * ".$tbl)){ while($row = $result->fetch_object()){ ?> <slide>     <id><?= $row->id ?></id>     <title><?= $row->title ?></title>     <chatter><?= $row->description ?></chatter>     <image><?= $row->path ?></image>     <link><?= $row->href ?></link>     <active><?= $row->active ?></active> </slide> <? } }else{     echo $mysqli->error; } 

edit: turns out have misunderstood problem. not apostrophes instead right single quotes. if change them actual apostrophes script works still don't understand why doesn't output them though.

try str_replace("'", "\'", $field_to_be_replaced);

you can replace ' char blank space if prefer, testing.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -