Jump to content

syntax error, unexpected T_IS_EQUAL


gaugeboson

Recommended Posts

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.