gaugeboson Posted March 16, 2008 Share Posted March 16, 2008 Parse error: syntax error, unexpected T_IS_EQUAL in C:\xampp\htdocs\newtopic.php on line 88 <?php session_start(); require("config.php"); require("functions.php"); $db = mysql_connect($dbhost, $dbuser, $dbpassword); mysql_select_db($dbdatabase, $db); $forchecksql = "SELECT * FROM forums;"; $forcheckresult = mysql_query($forchecksql); $forchecknumrows = mysql_num_rows($forcheckresult); if($forchecknumrows == 0) { header("Location: " . $config_basedir); } if(isset($_GET['id']) == TRUE) { if(is_numeric($_GET['id']) == FALSE) { $error = 1; } if($error == 1) { header("Location: " . $config_basedir); } else { $validforum = $_GET['id']; } } else { $validforum = 0; } if(isset($_SESSION['USERNAME']) == FALSE) { header("Location: " . $config_basedir . "/login.php?ref=newpost&id=" . $validforum); if($_POST['submit']) { if($validforum == 0) { $topicsql = "INSERT INTO topics(date, user_id, forum_id, subject) VALUES(NOW() , " . $_SESSION['USERID'] . ", " . $_POST['forum'] . ", '" . $_POST['subject'] . "');"; } else { $topicsql = "INSERT INTO topics(date, user_id, forum_id, subjet) VALUES(NOW() , " . $_SESSION['USERID'] . ", " . $validforum . ", '" . $_POST['subject'] . "');"; } mysql_query($topicsql); $topicid = mysql_insert_id(); $messages = "INSERT INTO messages(date, user_id, topic_id, subject, body) VALUES(NOW() , " . $_SESSION['USERID'] . ", " . mysql_insert_id() . ",'" . $_POST['subject'] . "', '" . $_POST['body'] . "');"; mysql_query($messagesql); header("Location: " . $config_basedir . "/viewmessages.php?id=" . $topicid); } else { require("header.php"); if($validforum !=0) { $namesql = "SELECT name FROM forums ORDER BY name;"; $nameresult = mysql_query($namesql); $namerow = mysql_fetch_assoc($nameresult); echo "<h2>Post a new message to the " . $namerow['name'] . " forum</h2>"; } else { echo "<h2>Post a new message</h2>"; } ?> <form action="<?php echo pf_script_with_get($SCRIPT_NAME); ?>" method="post"> <table> <?php if($validforum) == 0) { $forumsql = "SELECT * FROM forums ORDER BY name;"; $forumsresult = mysql_query($forumssql); ?> <tr> <td>forum</td> <td> <select name="forum"> <?php while($forumsrow = mysql_fetch_assoc($forumsresult)) { echo "<option value='" . $forumsrow['id'] . "'>" . $forumsrow['name'] . "</option>"; } ?> </select> </td> </tr> <?php } ?> <tr> <td>subject</td> <td><input type="text" name="subject"></td> </tr> <tr> <td>body</td> <td><textarea name="body" rows="10" cols="50"></textarea></td> </tr> <tr> <td></td> <td><input type="submit" name="submit" value="post!"></td> </tr> </table> </form> Link to comment https://forums.phpfreaks.com/topic/96415-syntax-error-unexpected-t_is_equal/ Share on other sites More sharing options...
pocobueno1388 Posted March 16, 2008 Share Posted March 16, 2008 Change this line: if($validforum) == 0) { To: if ($validforum == 0) { Link to comment https://forums.phpfreaks.com/topic/96415-syntax-error-unexpected-t_is_equal/#findComment-493432 Share on other sites More sharing options...
gaugeboson Posted March 16, 2008 Author Share Posted March 16, 2008 thanks. Link to comment https://forums.phpfreaks.com/topic/96415-syntax-error-unexpected-t_is_equal/#findComment-493441 Share on other sites More sharing options...
redarrow Posted March 16, 2008 Share Posted March 16, 2008 could off added this aswell <?php if( ($validforum) == 0) ) { ?> ) <<<< was missing mate........... live example <?php $x=array("01"=>"january.jpg","02"=>"febuary.jpg","03"=>"march.jpg", "04"=>"april.jpg","05"=>"may.jpg","06"=>"june.jpg","07"=>"july.jpg", "08"=>"august.jpg","09"=>"september.jpg","10"=>"october.jpg", "11"=>"november.jpg", "12"=>"december.jpg"); $date=date("m"); foreach($x as $key=> $val){ if( ($date)==($key) ){ // using the () to seprate the varables........ echo"<img src='$val'/>"; } } ?> Link to comment https://forums.phpfreaks.com/topic/96415-syntax-error-unexpected-t_is_equal/#findComment-493453 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.