php查询数据库表问题
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><br> <html xmlns="http://www.w3.org/1999/xhtml"><br> <head><br> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><br> <title>学生课题查询</title><br> <style type="text/css"><br> <!--<br /> .STYLE1 {font-size: 14px}<br /> --><br> </style><br> </head><br> <br> <body><br> <?php<br /> //######################学生查询所选课题##########################<br /> include "config.php";<br /> include "header.php";?><br> <?<br /> if($search)<br /> {<br /> if ($xuehao=="") <br /> {<br /> echo"<p align=\"center\"><font color=\"#FF0000\"><b><big>请填写您的学号!</big></b></font></p>";<br> echo "<meta http-equiv=\"refresh\" content=\"1;url=query.php\">";<br> exit; <br> } <br> <br> $query="select * from $student_table where xuehao='$xuehao'";<br> mysql_query("set names 'gb2312'");<br> $result=mysql_query($query);<br> $row=mysql_fetch_array($result);<br> if($row==0)<br> {<br> echo"<p align=\"center\"><font color=\"#FF0000\"><b><big>你还没有注册,或者你的输入有误,请重新输入!</big></b></font></p>";<br> echo "<meta http-equiv=\"refresh\" content=\"2;url=query.php\">";<br> exit;<br> }<br> <br> $query="select id as sm from $student_table where xuehao='$xuehao'";<br> mysql_query("set names 'gb2312'");<br> $result=mysql_query($query);<br> $row=mysql_fetch_array($result);<br> if($row[sm]==0)<br> {<br> echo"<p align=\"center\"><font color=\"#FF0000\"><b><big>你还没有选择课题,请去选题!</big></b></font></p>";<br> echo "<meta http-equiv=\"refresh\" content=\"2;url=keti_list.php\">";<br> exit;<br> }<br> ?><br> <table width="700" border="0" cellspacing="1" cellpadding="0" bgcolor="#333333" align="center"><br> <tr> <br> <td width="78" height="30" bgcolor="#FFFFFF"> <br> <div align="center" class="text"> <br> <p class="STYLE1">学生学号</p><br> </div><br> </td><br> <td width=97 height="30" bgcolor="#FFFFFF"> <br> <div align="center" class="STYLE1">学生姓名</div><br> </td><br> <td width="329" height="30" bgcolor="#FFFFFF"> <br> <div align="center" class="STYLE1"> 课题名称 </div> </td><br> <td width=106 height="30" bgcolor="#FFFFFF"> <br> <div align="center" class="STYLE1">指导教师</div><br> </td><br> <td width=84 height="30" bgcolor="#FFFFFF"> <br> <div align="center" class="STYLE1">职称</div> </td><br> </tr> <br> <br> $n=0; <br> $query=mysql_query("select * from $jiaoshi_table,$student_table where $jiaoshi_table.id=$student_table.id and $student_table.xuehao='$xuehao'"); <div class="clear"></div>