Forums

PHP

This topic is locked

showing double apostrophe on display

Posted 19 Aug 2003 11:19:01
1
has voted
19 Aug 2003 11:19:01 Adam Davies posted:
i've created a php site in dreamweaver and most is all well but for some reason in one of my mysql tables I have some names that have apostrpohes in them but when displayed on a page (or an edit form) they always are displayed as a double apostrophe for example in the table there is a field with data in it which is ireland's but on display it comes out as ireland''s

can anyone shed any light on that one for me????

Replies

Replied 19 Aug 2003 16:49:27
19 Aug 2003 16:49:27 Iain Stewart replied:
hi,

try when entering your text putting
ireland\'s instead of ireland's

the backslash is an escape and should make php ignore the apostrophy which i think is trying to close the string or script. You may also need to do the get " to show eg \"



Iain

head hurts, 'mental note to self, stop banging head !'
Replied 19 Aug 2003 18:26:53
19 Aug 2003 18:26:53 Adam Davies replied:
ok sorted now i changed the line from this:
<?php echo $row_RSstore['store_name']; ?>

to this@
<?php
if(substr_count($row_RSstore['store_name'],"''"==1)
$store_name=str_replace("''","'",$row_RSstore['store_name']);
else
$store_name=$row_RSstore['store_name'];
echo $store_name;
?>

Reply to this topic