Jump to content


Photo

highlight_stirng with preg_replace


  • Please log in to reply
2 replies to this topic

#1 Roee

Roee
  • Members
  • PipPip
  • Member
  • 20 posts

Posted 19 July 2006 - 05:33 PM

hi

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);


but if i try to write a " it makes mysql error:
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

why?

thanks

#2 Roee

Roee
  • Members
  • PipPip
  • Member
  • 20 posts

Posted 20 July 2006 - 09:09 AM

help!!

#3 ryanlwh

ryanlwh
  • Staff Alumni
  • Advanced Member
  • 511 posts

Posted 20 July 2006 - 08:42 PM

it's a mysql error, not php error...
Please use EDIT * 100...
Please use
or [php] * 1000...

PLEASE READ THE POSTED SOLUTIONS CAREFULLY * 1000000...




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users