php - Apostrophes not displaying correctly -
i’m making simple blog php, mysql , html. have problem while displaying apostrophes , quotes, instead of displaying "example" (in html page) displays \"example\", i’m using escape string , still not working :( page:
<?php $servidor = "xx"; $bd = "xx"; $usuario = "xx"; $senha = "xx"; mysql_connect($servidor, $usuario, $senha) or trigger_error(mysql_error()); mysql_select_db('a3722962_main') or trigger_error(mysql_error()); $tutoid = $_get['tuto']; $query = mysql_query("select * tutorials id = '$tutoid'"); while($line = mysql_fetch_array($query)) { $content = $line['text']; $title = $line['title']; $creator = $line['creator']; $name = $line['name']; $idtest = $line['id']; } {echo "$content";} ?>
the posting page:
<?php mysql_connect($servidor, $usuario, $senha) or trigger_error(mysql_error()); mysql_select_db('a3722962_main') or trigger_error(mysql_error()); $usuario = mysql_real_escape_string($_session['usuarionome']); $title = mysql_real_escape_string($_post['title']); $post = mysql_real_escape_string($_post['post']); $realname = $_session['usuario']; $lang = $_post['lang']; $cat = $_post['cat']; $dopost = "insert tutorials values ('', '$title', '$post', '$usuario', '$realname', now( ), '$cat', '$lang')"; if($title == "" or $post == "") { echo "<script>alert(please, fill out damn form...); location.href='inside' </script>"; } else { echo "<script>alert(your post has been added!); location.href='inside'</script>"; } if (!empty($_post) , (empty($post) or empty($title))) { echo "<script>alert('please fill out damn posting form.'); location.href='inside'</script>"; } else { $query = mysql_query($dopost); }; if($query) { echo "<script>alert('the post have setup has been added successfully! :d'); location.href='inside'</script>"; } else { echo "could not add post database."; echo mysql_error(); } ?>
thanks all!
call stripslashes
echo stripslashes($content);
Comments
Post a Comment