ShoeLace1291 Posted October 8, 2007 Share Posted October 8, 2007 I keep getting this error when I call a certain function but I don't get the error message when I call it on other pages on my site. I get this error: Fatal error: Cannot redeclare build_temp() (previously declared in C:\xampp\htdocs\voltbb\includes\functions.php:3) in C:\xampp\htdocs\voltbb\includes\functions.php on line 16 I don't think it's a problem with the function since I've used it on almost every other page on my site but here's the code for the page the error is occuring on: <?php //------------------------------------------------------------------------------------------------ // // You are viewing the contents of the viewthread.php file. // The content of this file is the sole property of the developer(s) of the VoltBB // project. Any duplication or re-distribution of this file without the inclusion of this // copyright is strictly prohibited and doing so will result in immediate legal action. // // Modification of this file requires a vast knowledge of the PHP and MySQL // languages. Edit this file at your own risk. // //------------------------------------------------------------------------------------------------ session_start(); require_once('config.php'); $action = $_GET["action"]; $tid = $_GET['id']; include('includes/functions.php'); include('includes/pageheader.php'); //If the thread is viewed... if($_GET['id']){ //update views in database $query = mysql_query("UPDATE vbb_threads SET tviews = tviews+1 WHERE tid = $tid"); } $forumid = mysql_query("SELECT tid FROM vbb_threads WHERE tid = $tid"); $gf=mysql_fetch_array($forumid); $fid=$gf["fid"]; $tsubject=$gf["tsubject"]; $forumname = mysql_query("SELECT fid FROM vbb_forums WHERE fid = $fid"); $fn=mysql_fetch_array($forumname); $fname=$fn["fname"]; echo "<div><a href='index.php'>Index</a> > <a href='viewforum.php?id=$fid'>$fname</a> > <a href='viewthread.php?id=$tid'>$tsubject</a><br><br> <a href='addreply.php?tid=$tid'>Add Reply</a></div> <table align='center' width='65%' cellspacing='1' cellpadding='1' border='0'> <tr> <td align='center' colspan='2' width='100%' class='header'>Viewing $tsubject</td> </tr><tr>"; //bbCodes $bb_replace = array('[b]', '[/b]', '[i]', '[/i]', '[u]', '[/u]'); $bb_replacements = array ('<b>', '</b>', '<i>', '</i>', '<u>', '</u>'); //Word filters $badwords = array('fuck', 'shit', 'pussy', 'dick', 'ass'); $replacements = array('make love', 'poop', 'vagina', 'penis', 'butt'); $ecodes= array('' => '<img src="images/sad.png" alt="sad">'); $images = array('<img src="images/sad.png">'); $threads = mysql_query("SELECT tid,tcreator,tcontent,tdatetime,tsubject FROM vbb_threads WHERE tid = $tid") or die("Error: ".mysql_error()); while($t=mysql_fetch_array($threads)) { $tid=$t["tid"]; $tcreator=$t["tcreator"]; $tcontent=$t["tcontent"]; $tdatetime=$t["tdatetime"]; $tsubject=$t["tsubject"]; if($perm == "1"){ $author_ip=$t["author_ip"]; } else { $author_ip = ""; } //Is author a registered member? $author = "SELECT uid,username FROM vbb_members WHERE uid = '$tcreator'"; $authorresult = mysql_query($author) or die("Error: ".mysql_error()); $final = mysql_num_rows($authorresult); if($final == 1){ $pi=mysql_fetch_array($authorresult); $regdate=$pi["reg_date"]; $memno=$pi["mem_no"]; $location=$pi["location"]; $website=$pi["website"]; $aim=$pi["aim"]; $msnm=$pi["msnm"]; $icq=$pi["icq"]; $getuserthreads = "SELECT tid FROM vbb_threads WHERE tcreator = '$tcreator'"; $threadresult = mysql_query($getuserthreads) or die("Error: ".mysql_error()); $numthreads = mysql_num_rows($threadresult); $getuserreplies = "SELECT replyid FROM vbb_replies WHERE rauthor = '$tcreator'"; $repliesresult = mysql_query($getuserreplies) or die("Error: ".mysql_error()); $numreplies = mysql_num_rows($repliesresult); $postcount = $numthreads + $getuserreplies; $tcontent = str_replace($bb_replace, $bb_replacements, $tcontent); $tcontent = str_replace($badwords, $replacements, $tcontent); $tcontent = str_replace($ecodes, $images, $tcontent); $temps = array( 'THREAD_ID' => $tid, 'THREAD_NAME' => $tsubject, 'THREAD_CREATOR' => $tcreator, 'THREAD_DATETIME' => $tdatetime, 'MESSAGE' => $tcontent, 'U_REG_DATE' => $regdate, 'U_MEMBER_NO' => $memno, 'U_LOCATION' => $location, 'U_WEBSITE' => $website, 'U_AIM_ADDRESS' => $aim, 'U_MSN_ADDRESS' => $msnm, 'U_ICQ_NUMBER' => $icq, 'U_POSTCOUNT' => $postcount, ); } else { $temps = array( 'THREAD_ID' => $tid, 'THREAD_NAME' => $tsubject, 'THREAD_CREATOR' => $tcreator, 'THREAD_DATETIME' => $tdatetime, 'MESSAGE' => $tcontent ); $file="templates/primary/viewthread_loggedout.tpl"; } $bulidthread = build_temp($file, $temps); echo $buildthread; } $replies = "SELECT * FROM vbb_replies WHERE tid = $tid ORDER BY rid DESC"; $repliesresult = mysql_query($replies) or die("Error: ".mysql_error()); $numreplies = mysql_num_rows($repliesresult); while($r=mysql_fetch_array($replies)) { $rid=$r["rid"]; $rauthor=$r["rauthor"]; $rcontent=$r["rcontent"]; $rdatetime=$r["rdatetime"]; if($perm == "1"){ $rauthor_ip=$r["author_ip"]; } else { $rauthor_ip = ""; } $rcontent = str_replace($bb_replace, $bb_replacements, $rcontent); $rcontent = str_replace($badwords, $replacements, $rcontent); $rcontent = str_replace($ecodes, $images, $rcontent); include("templates/$tpath/replies_body.tpl"); } echo "</table>"; include("templates/$tpath/footer_body.tpl"); ?> Thanks for any help. Quote Link to comment https://forums.phpfreaks.com/topic/72275-cant-figure-out-failure-to-redeclare-function/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.