Page 1 of 1
Warning: Unexpected character in input: ''
Posted: Sat Nov 20, 2004 1:17 am
by Steveo31
I've done all the searches and tried everything everyone threw at me, no luck getting this thing fixed.
Code: Select all
$output = preg_replace('|\[div](.*?)\[/div]|ise',"str_replace('<br />', null, "<div class='div_code'>".highlight_string('\\1',true)."</div>")", $row['body']);
echo nl2br(stripslashes($output));
Gives me
Code: Select all
$sql = mysql_query(
Warning: Unexpected character in input: '' (ASCII=92) state=1 in /home2/theobvi/public_html/includes/content/articles.php(31) : regexp code on line 16
It highlight_strings part of it, then throws this error, then the rest of the highlighted code is messed, i.e. quotes not being closed, so it's all red.
Any ideas?
Posted: Sat Nov 20, 2004 4:23 am
by potsed
Code: Select all
$output = preg_replace('|\їdiv](.*?)\ї/div]|ise',"str_replace('<br />', null, "<div class='div_code'>".highlight_string('\1',true)."</div>")", $rowї'body']);
try using
Code: Select all
$output = preg_replace('|\їdiv](.*?)\ї/div]|ise',"str_replace(''<br />'', null, "<div class='div_code'>".highlight_string('\1',true)."</div>")", $rowї'body']);
putting '' in after instead of just '
Posted: Sat Nov 20, 2004 1:37 pm
by Steveo31
Hmm.. is the forum getting rid of the backslash, cause it looks the same to me...
In any case, combinations of backslashes aren't working. An @ takes the error out, but the coloring is still askew.
ex:
http://www.theobviousreasons.com/index. ... asic+MySQL
Posted: Sun Nov 21, 2004 4:42 pm
by Steveo31
bumparoo
Posted: Mon Nov 22, 2004 2:54 am
by phpScott
the @ will take out the error as php uses it to suppress errors.
I would start by dismatiling your string and slowly rebuild it to see if there is a quote that is being missed or unescaped.
Posted: Tue Nov 23, 2004 1:22 am
by Steveo31
Right, yea at least without the error people could see the code uninterrupted. Just a temp measure.
I'll try that and let you know. Thanks.
Posted: Fri Nov 26, 2004 4:50 pm
by Steveo31
Ok, well the reason this thing keeps exploding on me is the " mark. It has no probs with ', but the second a " comes in, kaboom.
It's obviously because the second param of the preg_replace is in double quotes... any way around it?
Code: Select all
$output = preg_replace('|\[div](.*?)\[/div]|ise',"str_replace('<br />', null, "<div class='div_code'>".highlight_string('\\\\1',true)."</div>")",