chapter 15 forum bbcode
I've encountered a problem when I tried to designate words that will be replaced by different phrases on page 547.
I'm getting this error:
Warning: Unknown modifier '? in functions.php on line 334
any help is appreciated.
This is the code from the book:
function bbcode($data)
{ $sql = "SELECT * FROM forum_bbcode";
$result = mysql_query($sql);
if (mysql_num_rows($result) > 0)
{ while($row = mysql_fetch_array($result))
{ $bbcode['tpl'][] = "¡±" . html_entity_decode($row
['template'],ENT_QUOTES). "¡±i";
$bbcode['rep'][] = html_entity_decode($row
['replacement'],ENT_QUOTES);
}
$data1 = preg_replace($bbcode['tpl'],$bbcode['rep'],$data);
$count = 1;
while (($data1 != $data) and ($count < 4))
{ $count++;
$data = $data1;
$data1 = preg_replace($bbcode['tpl'],$bbcode['rep'],$data);
}
}
return $data;
}
|