我只知道我的这段代码缺一个花括号 } 但我不知道该填在哪里。我想要的结果是输入学号后可以正常显示,如果有必要的话,我可以把花括号填在任何一个地方后运行的结果截图出来。
<?php
if($search)
{
  if ($xuehao=="") 
 {
echo"<p align=\"center\"><font color=\"#FF0000\"><b><big>请填写您的学号!</big></b></font></p>";
echo "<meta http-equiv=\"refresh\" content=\"1;url=query.php\">";
exit;
 }  
   }
 $query="select * from $student_table where xuehao='$xuehao'";
 mysql_query("set names GB2312");
 $result=mysql_query($query);
 $row=mysql_fetch_array($result);
 if($row==0)
 {
echo"<p align=\"center\"><font color=\"#FF0000\"><b><big>你还没有注册,或者你的输入有误,请重新输入!</big></b></font></p>";
echo "<meta http-equiv=\"refresh\" content=\"2;url=query.php\">";
    exit;
 }
   
 $query="select id as sm from $student_table where xuehao='$xuehao'";
 mysql_query("set names 'GB2312'");
 $result=mysql_query($query);
 $row=mysql_fetch_array($result);
 if($row[sm]==0)
 {
echo"<p align=\"center\"><font color=\"#FF0000\"><b><big>你还没有选择课题,请去选题!</big></b></font></p>";
echo "<meta http-equiv=\"refresh\" content=\"2;url=keti_list.php\">";
    exit;
 }
  
 ?>
<table width="700" border="0" cellspacing="1" cellpadding="0" bgcolor="#333333" align="center">
  <tr> 
  <td width="78" height="30" bgcolor="#FFFFFF"> 
      <div align="center" class="text"> 
        <p class="STYLE1">学生学号</p>
      </div>
    </td>
    <td width=97 height="30" bgcolor="#FFFFFF"> 
      <div align="center" class="STYLE1">学生姓名</div>
    </td>
    <td width="329" height="30" bgcolor="#FFFFFF"> 
    <div align="center" class="STYLE1"> 课题名称 </div>    </td>
    <td width=106 height="30" bgcolor="#FFFFFF"> 
      <div align="center" class="STYLE1">指导教师</div>
    </td>
    <td width=84 height="30" bgcolor="#FFFFFF"> 
    <div align="center" class="STYLE1">职称</div>    </td>
  </tr> 
  <?php 
  $n=0; 
   $query=mysql_query("select * from $jiaoshi_table,$student_table where $jiaoshi_table.id=$student_table.id and $student_table.xuehao='$xuehao'");
   mysql_query("set names GB2312");
   while($row=mysql_fetch_array($query)){
        if(($n%2)!='0'){
    echo "<tr bgcolor=#FFFFff>";}
  else{
  echo "<tr bgcolor=#E4E4E4>";
  }
     echo"
 <td   height='22' class='STYLE1'> <div align='center'>".$row['xuehao']."</div></td>
 <td   height='22'> 
<div align='center' class='STYLE1'>".$row['name']."</div></td>
    <td   height='22' class='STYLE1'> <div align='center'>".$row['subject']."</div></td>
    <td   height='22' class='STYLE1'> <div align='center'>".$row['teacher']."</div></td>
<td   height='22' class='STYLE1'> <div align='center'>".$row['zhicheng']."</div></td>
  </tr> ";
   $n++;
   }
 ?></table>
 <p>
 </p>
<?php  include "foot.php";?>php

解决方案 »

  1.   

    我把它加在最后一行 
    <?php } include "foot.php";?>
      

  2.   

    我是菜鸟,对php处于完全入门阶段……
      

  3.   

    加在最后的话就会显示( ! ) SCREAM: Error suppression ignored for 
    ( ! ) Notice: Undefined variable: search in D:\wamp\www\selectsubject3\query1.php on line 3 
    Call Stack 
    # Time Memory Function Location 
    1 0.0010 149536 {main}( ) ..\query1.php:0 
      

  4.   

    从你 http://bbs.csdn.net/topics/390451883?page=1#post-394465455 #8的代码上看
       $n++;
       }
    } ?></table>
     <p>
     </p>
    <?php include "foot.php";?>
    的确少了个 }
      

  5.   

    Notice: Undefined variable: search
    提示 $searche 变量为定义
      

  6.   

    $search 是干什么用的,取自上个页面的form表单?详细描述一下你的业务逻辑。
    另外,代码要贴全。