Jump to content

[SOLVED] Error Expecting ) But its there


ambo

Recommended Posts

Parse error: parse error, unexpected ';', expecting ')' in /home/content/d/e/c/decuralogin/html/Process/add_topic.php on line 43

Line 43 Being the last one shown Any ideas

$patterns = array(

"/\[url\](.*?)\[\/url\]/",
"/\[img\](.*?)\[\/img\]/",
"/\[b\](.*?)\[\/B\]/",
"/\[b\](.*?)\[\/b\]/",
"/\[u\](.*?)\[\/U\]/",
"/\[u\](.*?)\[\/u\]/",
"/\[i\](.*?)\[\/I\]/",
"/\[i\](.*?)\[\/i\]/",
"/\[quote\](.*?)\[\/quote\]/",
"/\[quote\](.*?)\[\/QUOTE\]/",
"/\[code\](.*?)\[\/code\]/",
"/\[code\](.*?)\[\/CODE\]/",
"/\[s\](.*?)\[\/s\]/",
"/\[s\](.*?)\[\/S\]/",
"/\[url=(.*?)\](.*?)\[\/url\]/",
"/\[color=(.*?)\](.*?)\[\/color\]/",
"/\[size=(.*?)\](.*?)\[\/size\]/",
"/\[marquee\](.*?)\[\/marquee\]/",
"/\[br\]/",
"/\:\)/",
"/\:\(/",
"/\:O/",
"/\:P/",
"/\:\|/",
"/\:D/",
"/\:!!!\:/");

Link to comment
https://forums.phpfreaks.com/topic/146976-solved-error-expecting-but-its-there/
Share on other sites

Its To process BBCODE

<?php
include("dbconnect.php");
$tbl_name="forum_question"; // Table name 

// get data that sent from form 
$topic=$_POST['topic'];
$name=$_POST['name'];
$message = $_POST['mytxtarea'];
$message = str_replace("<", "", $message);
$message = str_replace(">", "", $message);
$patterns = array(

$patterns = array(

"/\[url\](.*?)\[\/url\]/",
"/\[img\](.*?)\[\/img\]/",
"/\[b\](.*?)\[\/B\]/",
"/\[b\](.*?)\[\/b\]/",
"/\[u\](.*?)\[\/U\]/",
"/\[u\](.*?)\[\/u\]/",
"/\[i\](.*?)\[\/I\]/",
"/\[i\](.*?)\[\/i\]/",
"/\[quote\](.*?)\[\/quote\]/",
"/\[quote\](.*?)\[\/QUOTE\]/",
"/\[code\](.*?)\[\/code\]/",
"/\[code\](.*?)\[\/CODE\]/",
"/\[s\](.*?)\[\/s\]/",
"/\[s\](.*?)\[\/S\]/",
"/\[url=(.*?)\](.*?)\[\/url\]/",
"/\[color=(.*?)\](.*?)\[\/color\]/",
"/\[size=(.*?)\](.*?)\[\/size\]/",
"/\[marquee\](.*?)\[\/marquee\]/",
"/\[br\]/",

//emoticons

"/\:\)/",
"/\:\(/",
"/\:O/",
"/\:P/",
"/\:\|/",
"/\:D/",
"/\:!!!\:/");

$replacements = array(

//bbcode

"<a href=\"\\1\">\\1</a>",
"<img border=0 src='\\1'>",
"<b>\\1</b>",
"<b>\\1</b>",
"<u>\\1</u>",
"<u>\\1</u>",
"<i>\\1</i>", 
"<i>\\1</i>", 
"<div><b>Quote:</b> <i>\\1</i></div>", 
"<div><b>Quote:</b> \\1</div>",
"<b>Code:</b><div style='line-height: 12px; width: 99%; white-space: nowrap; overflow: auto; max-height: 25em;'>\\1</div>",
"<b>Code:</b><div style='line-height: 12px; width: 99%; white-space: nowrap; overflow: auto; max-height: 25em;'>\\1</div>",
"<s>\\1</s>",
"<s>\\1</s>",
"<a href=\"\\1\" target=\"_blank\">\\2</a>",
"<font color=\"\\1\">\\2</font>",
"<font size=\"\\1\">\\2</font>",
"<marquee>\\1</marquee>",
"<br />", 

//emoticons

"<img src=\"bbeditor/images/smilies/yellow/smile.gif\" border=\"0\">",
"<img src=\"bbeditor/images/smilies/yellow/sad.gif\" border=\"0\">",
"<img src=\"bbeditor/images/smilies/yellow/angry.gif\" border=\"0\">",
"<img src=\"bbeditor/images/smilies/yellow/tongue.gif\" border=\"0\">",
"<img src=\"bbeditor/images/smilies/yellow/dry.gif\" border=\"0\">",
"<img src=\"bbeditor/images/smilies/yellow/woot.gif\" border=\"0\">",
"<img src=\"bbeditor/images/smilies/yellow/exc.gif\" border=\"0\">");

$post = preg_replace($patterns,$replacements, $message);



$datetime=date("d/m/y h:i:s"); //create date time

$sql="INSERT INTO $tbl_name(topic, detail, name, datetime)VALUES('$topic', '$post', '$name', '$datetime')";
$result=mysql_query($sql);

if($result){
echo "Successful<BR>";
echo "<a href=../forum.php>View your topic</a>";
}
else {
echo "ERROR";
}
mysql_close();
?>

Archived

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

×
×
  • Create New...

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.