2013-01-15 53 views
-1

可能重複:
Escaping double quotes in php顯示雙引號在我的網頁

在我的數據庫,記錄被shoing像this is php's code and "called" a special code。 當我試圖獲取從MySQL數據庫我的PHP頁面這段文字,它顯示多達this is php's code and
我的代碼很簡單:

$all_gallery_ph_sql = mysql_query("SELECT `path`,`name`,`title`,`details` FROM `gallery` WHERE `status`='1' AND `type`='myreference' AND `enable_status`='1' LIMIT {$startpoint} ,{$limit}");          
echo $res['details']; 

enter image description here 那麼如何解決這個問題。請幫幫我。 謝謝。

+1

確定整個字符串是擺在首位的數據庫? –

回答

2

您可以使用htmlentities()

echo htmlentities($gallerycontent['content'], ENT_QUOTES); 
+1

對不起!它不工作。 – phpdeveloper

+1

@phpdeveloper你確定你提供的例子是完整的嗎? – Sirko

+0

從管理面板我只是通過使用mysql_real_escape_string函數添加這些細節,並在數據庫中上傳後,我在我的前端頁面中獲取此。此外,我可以說,在表格結構中,'content'字段的排序規則是'utf8_general_ci'。 – phpdeveloper