意想不到什么都没有错?

时间:2010-12-10 10:49:59

标签: php mysql

if(isset($_SESSION['adminbra']) && $_SESSION['adminbra'] == TRUE){
if($_SERVER['REQUEST_METHOD'] == "POST"){
 $updtqry = "UPDATE bra
    SET 
     bugtitle = '". mysql_real_escape_string($_POST['bugtitle']) ."',
     status = '". mysql_real_escape_string($_POST['bugstatus']) ."',
     bugdetails = '". mysql_real_escape_string($_POST['bugdetails'] ."'

    WHERE 
     bugid = '". $_SESSION['braupdid'] ."'
    "; // Row 166
 if(!$res = mysql_query($updtqry)) 
 { 
  echo 'Mysql error! Contact webmaster ASAP!<br/>';
 } 
 elseif(mysql_affected_rows() == 0) 
 { 
  echo 'No updates where made!<br/>';
 } 
 else 
 { 
  echo 'Updated.<br/>'; 
 }

}
else
{
 if(isset($_GET['id']) && is_numeric($_GET['id'])){
  $qry1 = "SELECT *
      FROM bra
      WHERE bugid = '". $_GET['id'] ."'
        ";
  $mysqlqry1 = mysql_query($qry1);
  if($mysqlqry1){
   if(mysql_num_rows($mysqlqry1) > 0){
    while($row1 = mysql_fetch_assoc($mysqlqry1)){
     $_SESSION['braupdid'] = $row1['bugid'];
     echo '<form action="bra.php?action=editbug" method="post">';
     echo 'Bug title: <input type="text" name="bugtitle" value="'. $row1['bugtitle'] .'"/><br/>';
     echo 'Bug status: <select name="bugstatus">';
     echo '<option value="0">Not fixed</option>';
     echo '<option value="1">Fixed</option>';
     echo '<option value="2">Nofix</option>';
     echo '</select><br/>';
     echo 'Details: <br/>';
     echo '<textarea cols="50" rows="5" name="bugdetails">'. $row1['bugdetails'] .'</textarea>';
     echo '<input type="submit" value="submit"/>';
    }
   }
   else
   {
    echo 'Invalid bug id.<br/>';
   }
  }
  else
  {
   echo 'Mysql query failed! Contact webmaster ASAP!<br/>';
  }
 }
 else
 {
  echo 'Please provide a valid bug id.<br/>';
 }
}
}
else
{
 echo '<a href="bra.php?action=adminlogin">Login</a> first.<br/>';
}

再次问好stackoverflow ...

我在此代码中遇到错误: 解析错误:语法错误,意外';'在C:\ data \ home \ EasyPHP5.2.10 \ www \ BRA - 第166行的错误报告Admin \ bra.php

但问题出在哪里?第166行就在$ updtqry之后。

1 个答案:

答案 0 :(得分:8)

mysql_real_escape_string($_POST['bugdetails']缺少)