Jump to content


This topic is now archived and is closed to further replies.


highlight_stirng with preg_replace

Recommended Posts


i tried to write this:
$content = $_POST['content'];
$match = array('#\[PHP\](.*?)\[\/PHP\]#se');
$replace = array("'<div style=\"margin:25px; margin-top:5px\"><div class=\"smallfont\" style=\"margin-bottom:2px\">PHP code:</div><div class=\"alt2\" style=\"margin:0px; padding:6px; border:1px inset; overflow:auto\"><code style=\"white-space:nowrap\"><div dir=\"ltr\" style=\"text-align:left;\">'.highlight_string(stripslashes('$1'), true).'</div></code></div></div>'");
$content = preg_replace($match, $replace, $content);[/code]

but if i try to write a " it makes mysql error:
[b]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\' (ASCII=92) state=1[/b]



Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.