php - extra /// when pulling info from database -
i using funstion insert data database
so here inserts
i inserting
<div class="widget" id="recentcomments"><h2>blog</h2></div> update_option("head-text", mysql_real_escape_string($head_text));
so inserts database , when save , pull out below.
<input type="text" name="head-text" id="head-text" class="regular-text" value="<?php echo htmlentities($head_text, ent_quotes); ?>"/>
i following.
<div class=\\\"widget\\\" id=\\\"recentcomments\\\"><h2>blog</h2></div>
loads off \\\\
sorry vag question before.
according manual mysql_real_escape_string
if magic_quotes_gpc enabled, first apply stripslashes() data. using function on data has been escaped escape data twice.
you can go function (in case don't want use prepared statements)
function safe($input) { if (get_magic_quotes_gpc()) { $input = stripslashes($input); $escaped = mysql_real_escape_string($input); } else { $escaped = mysql_real_escape_string($input); } return $escaped; }
there's no need call stripslashes() on output if sql escaping done properly
Comments
Post a Comment