[PHP] I need help-->Parse Error

Newbie Spellweaver
Joined
Jul 16, 2007
Messages
20
Reaction score
0
So i'm trying to build a WoW community site, andi get this error on a page:

faultCode0faultStringParse error:syntax error, unexpected $end in /home/vol2/warezhostz.info/wz_993675/kzone.warezhostz.info/htdocs/newpost.php on line 88


Here is the file:

PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<?php include("includes/head.php"); ?>

<?php
require_once('../includes/DbConnector.php');
require_once('../includes/Validator.php');

$connector = new DbConnector();

if ($HTTP_POST_VARS){

$validator = new Validator();

$validator->validateTextOnly($HTTP_POST_VARS['title'],'Post Title');
$validator->validateTextOnly($HTTP_POST_VARS['tags'],'Tags');
$validator->validateNumber($HTTP_POST_VARS['section'],'Section');
$validator->validateGeneral($HTTP_POST_VARS['posttext'],'Main Post Text');

if ( $validator->foundErrors() ){
    echo 'There was a problem with: <br>'.$validator->listErrors('<br>');
}else{

$insertQuery = "INSERT INTO posts (title,tags,section,posttext) VALUES (".
"'".$HTTP_POST_VARS['title']."', ".
"'".$HTTP_POST_VARS['tags']."', ".
$HTTP_POST_VARS['section'].", ".
"'".$HTTP_POST_VARS['posttext']."')";

if ($result = $connector->query($insertQuery)){

echo '<center><b>POST ADDED...</b></center><br>';

}else{

exit('<center>ERROR SAVING TO DATABASE...</center>');

}

}
?>

<body>
<div id="wrapper">
<div style="position: absolute; top:-8%;">
<img src="http://forum.ragezone.com/images/bshelf.png" alt="" title="" />
</div>
<div class="topt">
<img src="http://forum.ragezone.com/images/woxhead.jpg" alt="" title="" />
</div>

    <div id="content">
        <!-- Start left-right blocks loop -->
<?php include("includes/sitenews.php"); ?>
<?php include("includes/sitemenu.php"); ?>
<?php include("includes/linksnaffils.php"); ?>
<!-- End left-right blocks loop -->

    </div>

    <div id="centercontent">

<div class="centerc">
        <div class="blockTitlerl">New Post</div>
        <div class="blockContentc">
<form name="form1" method="post" action="newPost.php">
        <p> Title:
          <input name="title" type="text" id="title">
        </p>
        <p> Tags:
          <input name="tags" type="text" id="tags">
        </p>
        <p> Section:
          <input name="section" type="text" id="section">
        </p>
        <p> Main Post text:
          <textarea name="posttext" cols="50" rows="10" id="posttext"></textarea>
        </p>
        <p align="center">
          <input type="submit" name="Submit" value="Submit">
        </p>
</form>

    </div>
    </div>

</div>
</div>

<?php include("includes/footer.php"); ?>
</body>
</html>

Could anyone tell me what i have to change to fix this?
 
PHP:
}

}
?>
Why having this 2 times ?

Thats no problem.

Code:
[COLOR=#000000][COLOR=#007700]if ([/COLOR][COLOR=#0000BB]$HTTP_POST_VARS[/COLOR][COLOR=#007700]){[/COLOR][/COLOR]
is never closed.
 
Code:
$con = mysql_connect("*","*","*");
mysql_select_db("your_db", $con);
mysql_query("INSERT INTO Table (`Name`,`Str`)
VALUES ('$user','$str'')");
echo mysql_error();//just in case of a emergency
mysql_close($con);
 
mysql_query("INSERT INTO Table (`Name`,`Str`)
VALUES ('$user','$str'' <-- HERES YOUR PROBLEM )");

only a single quote needed there, not 2 single quotes xD

so

mysql_query("INSERT INTO Table (`Name`,`Str`)
VALUES ('$user','$str')");
 
Back