parse error

Discussion in 'PHP' started by co.ador, Jul 25, 2009.

  1. #1
    Hi there is an error in line 110

    Parse error: syntax error, unexpected ')' in /home4/ryanrees/public_html/crap/myrating.php.php on line 110
    can any body help the script is below and line 110 is commented.

    <?php
      require_once("classes/include.all.php");
    ?> 
    <?php
    
    if(isset($_POST['submit' ])){ 
    
    $nickname = mysql_real_escape_string($_POST['nickname']);
    $email = mysql_real_escape_string($_POST['email']);
    
    $comment = mysql_real_escape_string($_POST['comment']);
    
    $query = "INSERT INTO comment VALUES ( NOW(), '$nickname' , '$email', '$comment',)";
    echo $query;
    $result = mysql_query($query) or die (mysql_error());
    
    header("Location: http://localhost/ratingsystem/myrating.php");
    exit;
    
    }
    
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
        <title>Help on building a rating system for the commnury </title>
        <link type="text/css" href="../wamp/www/nyhungry/restaurants/styles/rating.css" rel="stylesheet" media="all" />
    <script type="text/javascript" src="../scripts/prototype.js"></script>
    <script type="text/javascript" src="../scripts/rating.js"></script>
        
      
      </head>
      
       <body>
     <h4>Help on Building this Rating System for the use of the Community</h4>
        
        <h3>Demo Rating System:</h3>
      Nike Air Jordan:<?php
          $ratingData = Rating::OutputRating('demo');
          
          if (Error::HasErrors())
          {
            echo Error::ShowErrorMessages();
            Error::ClearErrors();
          }
          else
          {
            echo $ratingData;
          }
        ?>
    	Fila scot:<?php 
          $ratingData = Rating::OutputRating('paul');
          
          if (Error::HasErrors())
          {
            echo Error::ShowErrorMessages();
            Error::ClearErrors();
          }
          else
          {
            echo $ratingData;
          }
        ?>
    	Adidas Shaq:<?php
          $ratingData = Rating::OutputRating('matt');
          
          if (Error::HasErrors())
          {
            echo Error::ShowErrorMessages();
            Error::ClearErrors();
          }
          else
          {
            echo $ratingData;
          }
        ?>
    	Convers Felix:<?php
          $ratingData = Rating::OutputRating('felo');
          
          if (Error::HasErrors())
          {
            echo Error::ShowErrorMessages();
            Error::ClearErrors();
          }
          else
          {
            echo $ratingData;
          }
        ?>
    	Timberland:<?php
          $ratingData = Rating::OutputRating('carmelo');
          
          if (Error::HasErrors())
          {
            echo Error::ShowErrorMessages();
            Error::ClearErrors();
          }
          else
          {
            echo $ratingData;
          }
        ?>  
        <?php
    $rResult = mysql_query(
       
          sprintf(
            "SELECT * FROM comments ORDER BY created ASC",
           
        ) // line 110
    );
    
    
    if(mysql_num_rows($rResult) > 0)
    {
        while($aComment = mysql_fetch_assoc($rResult))
        {
            printf(
                
    			'<img src="../images/line..gif" alt="df" width="400" height="1" />
    			<br />
                <div class="comment" style="margin-bottom: 2em;">
                    <div class="author">
                      <strong>Nickname:</strong>
    				  %s 
                    </div>  
    				<br />
                    <div class="body">
                        <strong>E-mail:</strong>
    					%s
                    </div>
    				<br />
                    <div class="body">
                        <strong>Comment:</strong>
    					%s
                    </div>
    				<br />
                    <div class="meta-info" style="font-size: 0.8em; position:relative; left:300px;">
                        <strong>Time:</strong>
    					%s
                    </div>
                </div>
                ',
                $aComment['nickname'],
                $aComment['email'],
                $aComment['comment'],
                $aComment['created']
            );
        }
    }
    else
    {
        echo 'No comments has been posted!';
    }
    ?>  
        
    <tr>
    <td>
    <table width="487" style="top:850px;" class="calamar">
    <td width="479" style=" line-height:3;"><strong>Comments:</strong></td>
    
    <tr></tr><td style="font-family:\'Times New Roman\', Times, serif; font-size:14px;">
    
    <form id="itemcomments" action="../wamp/www/ratingsytem/myrating.php" method="post">
    
      <fieldset>
    
        <legend>Make a comment on this rating system</legend>
    
        
        <div>
    
          <label for="nickname">Nickname:</label>
    
          <input type="text" name="nickname" id="nickname" maxlength="85" />
    
        </div>
    
      <div>
    
          <label for="email">E-mail:</label>
       
          <input name="email" type="text" id="email" value="" size="22">
    
        </div>
        
        <div>
    
          <label for="comment">comment:</label>
    
          <textarea name="comment" id="comment" cols="35" rows="5"></textarea>
    
        </div>
    
     
        <input type="submit" name="submit" value="Add Comment">
    
        <input type="reset" value="Reset Fields">   
    
      </fieldset>
    
    </form>
    
    </table>
    </td>
    </tr>
    =------------------------------------------------------------------------------------------------------------------------------
      </body>
    </html>
    PHP:

     
    co.ador, Jul 25, 2009 IP
  2. CRASS

    CRASS Active Member

    Messages:
    47
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    91
    #2
    Ummm you forgot to close the bracket ) // line 110 should be ); // line 110
     
    CRASS, Jul 25, 2009 IP
  3. co.ador

    co.ador Peon

    Messages:
    120
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    now is this guys

    The insert part of the script



    I made the fixes you gave me now it's show the above message.
    <?php
    
    if(isset($_POST['submit' ])){ 
    
    $nickname = mysql_real_escape_string($_POST['nickname']);
    $email = mysql_real_escape_string($_POST['email']);
    
    $comment = mysql_real_escape_string($_POST['comment']);
    
    $query = "INSERT INTO comment VALUES ( NOW(), '$nickname' , '$email', '$comment',)";
    echo $query;
    $result = mysql_query($query) or die (mysql_error());
    
    header("Location: http://localhost/shoes/stores/itemdetailsrating.php");
    exit;
    
    }
    
    ?>
    PHP:
     
    co.ador, Jul 25, 2009 IP
  4. co.ador

    co.ador Peon

    Messages:
    120
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    guys I found the problem the auto counting for the id wasn't provided
    plus I was putting a comma at the end of the injection now it is working


    do you see the comma after $comment? well it was supposed to be without the comma I guess it was looking for another variable, Sorry mysql I was giving you a headache Lol

    thank you guys...
     
    co.ador, Jul 25, 2009 IP