运行结果如下图,貌似只有前24行有问题。如果读取数据库表正常,每一栏里应该显示数据库当中的内容。<?php
//######################课题详细信息##########################
include "config.php";
include "header.php";?>
<title>课题详细信息</title>
<style type="text/css">
<!--
.STYLE1 {
font-size: 16px;
color: #FF0000;
}
.STYLE2 {font-size: 14px}
.STYLE3 {font-size: 12px}
-->
</style>
<p>
</p>
<?php $query="select * from $jiaoshi_table where id='".$id."'";
mysql_query("set names 'GB2312'");
$result=mysql_query($query);
$row=mysql_fetch_array($result);
?><table width="700" border="1" align="center" cellpadding="0" cellspacing="1" class="text">
<!--DWLayoutTable-->
<form name="form1" method="post" action="xiangxiziliao.php">
<tr bgcolor="#E4E4E4">
<td height="27" colspan="3"><span class="STYLE1 STYLE2">>>>课题信息</span></td> </tr>
<tr>
<td width="184" bgcolor="#FFFFFF"><div align="center" class="STYLE2">
<div align="right">课题编号:</div>
</div></td>
<td width="507" bgcolor="#FFFFFF" height="39"> <input type="text" name="id" size="28" value="<?php echo $row['id'] ?>" readonly="readonly">
</td>
</tr>
<tr>
<td width="184" bgcolor="#E4E4E4"><div align="center" class="STYLE2">
<div align="right">课题名称:</div>
</div></td>
<td width="507" bgcolor="#E4E4E4" height="39"> <input type="text" name="subject1" size="45" value="<?php echo $row['subject'] ?>" readonly="readonly">
</td>
</tr>
<tr>
<td width="184" bgcolor="#FFFFFF"><div align="center" class="STYLE2">
<div align="right">指导教师姓名:</div>
</div></td>
<td width="507" bgcolor="#FFFFFF" height="36"> <input type="text" name="teacher1" size="30" value="<?php echo $row['teacher'] ?>" readonly="readonly"> </td>
</tr>
<tr>
<td width="184" bgcolor="#E4E4E4"><div align="center" class="STYLE2">
<div align="right">指导教师职称:</div>
</div></td>
<td width="507" bgcolor="#E4E4E4" height="41"> <input type="text" name="zhicheng1" size="25" value="<?php echo $row['zhicheng'] ?>" readonly="readonly"> </td>
</tr>
<tr>
<td width="184" bgcolor="#FFFFFF"><div align="center" class="STYLE2">
<div align="right">教师的研究方向:</div>
</div></td>
<td width="507" bgcolor="#FFFFFF" height="41"> <input type="text" name="specialized1" size="25" value="<?php echo $row['specialized'] ?>" readonly="readonly"> </td>
</tr>
<tr>
<td width="184" bgcolor="#E4E4E4"><div align="center" class="STYLE2">
<div align="right">课题专业代码:</div>
</div></td>
<td width="507" bgcolor="#E4E4E4" height="41"> <input type="text" name="code1" size="20" value="<?php echo $row['code'] ?>" readonly="readonly">
<span class="STYLE3"></span></td>
</tr>
<tr>
<td width="184" bgcolor="#FFFFFF"><div align="center" class="STYLE2">
<div align="right">课题所需学生人数:</div>
</div></td>
<td width="507" bgcolor="#FFFFFF" height="41"> <input type="text" name="number1" size="20" value="<?php echo $row['number'] ?>" readonly="readonly">
<span class="STYLE3"></span></td>
</tr>
<tr>
<td width="184" bgcolor="#FFFFFF"><div align="center" class="STYLE2">
<div align="right">课题简要说明:</div>
</div></td>
<td width="507" bgcolor="#FFFFFF" height="163"><label>
<textarea name="introduction" cols="60" rows="10" readonly="readonly"><?php echo $row['beizhu'] ?></textarea>
</label></td>
</tr>
</form>
</table>
<p>
</p>
<?php include "foot.php"?>
//######################课题详细信息##########################
include "config.php";
include "header.php";?>
<title>课题详细信息</title>
<style type="text/css">
<!--
.STYLE1 {
font-size: 16px;
color: #FF0000;
}
.STYLE2 {font-size: 14px}
.STYLE3 {font-size: 12px}
-->
</style>
<p>
</p>
<?php $query="select * from $jiaoshi_table where id='".$id."'";
mysql_query("set names 'GB2312'");
$result=mysql_query($query);
$row=mysql_fetch_array($result);
?><table width="700" border="1" align="center" cellpadding="0" cellspacing="1" class="text">
<!--DWLayoutTable-->
<form name="form1" method="post" action="xiangxiziliao.php">
<tr bgcolor="#E4E4E4">
<td height="27" colspan="3"><span class="STYLE1 STYLE2">>>>课题信息</span></td> </tr>
<tr>
<td width="184" bgcolor="#FFFFFF"><div align="center" class="STYLE2">
<div align="right">课题编号:</div>
</div></td>
<td width="507" bgcolor="#FFFFFF" height="39"> <input type="text" name="id" size="28" value="<?php echo $row['id'] ?>" readonly="readonly">
</td>
</tr>
<tr>
<td width="184" bgcolor="#E4E4E4"><div align="center" class="STYLE2">
<div align="right">课题名称:</div>
</div></td>
<td width="507" bgcolor="#E4E4E4" height="39"> <input type="text" name="subject1" size="45" value="<?php echo $row['subject'] ?>" readonly="readonly">
</td>
</tr>
<tr>
<td width="184" bgcolor="#FFFFFF"><div align="center" class="STYLE2">
<div align="right">指导教师姓名:</div>
</div></td>
<td width="507" bgcolor="#FFFFFF" height="36"> <input type="text" name="teacher1" size="30" value="<?php echo $row['teacher'] ?>" readonly="readonly"> </td>
</tr>
<tr>
<td width="184" bgcolor="#E4E4E4"><div align="center" class="STYLE2">
<div align="right">指导教师职称:</div>
</div></td>
<td width="507" bgcolor="#E4E4E4" height="41"> <input type="text" name="zhicheng1" size="25" value="<?php echo $row['zhicheng'] ?>" readonly="readonly"> </td>
</tr>
<tr>
<td width="184" bgcolor="#FFFFFF"><div align="center" class="STYLE2">
<div align="right">教师的研究方向:</div>
</div></td>
<td width="507" bgcolor="#FFFFFF" height="41"> <input type="text" name="specialized1" size="25" value="<?php echo $row['specialized'] ?>" readonly="readonly"> </td>
</tr>
<tr>
<td width="184" bgcolor="#E4E4E4"><div align="center" class="STYLE2">
<div align="right">课题专业代码:</div>
</div></td>
<td width="507" bgcolor="#E4E4E4" height="41"> <input type="text" name="code1" size="20" value="<?php echo $row['code'] ?>" readonly="readonly">
<span class="STYLE3"></span></td>
</tr>
<tr>
<td width="184" bgcolor="#FFFFFF"><div align="center" class="STYLE2">
<div align="right">课题所需学生人数:</div>
</div></td>
<td width="507" bgcolor="#FFFFFF" height="41"> <input type="text" name="number1" size="20" value="<?php echo $row['number'] ?>" readonly="readonly">
<span class="STYLE3"></span></td>
</tr>
<tr>
<td width="184" bgcolor="#FFFFFF"><div align="center" class="STYLE2">
<div align="right">课题简要说明:</div>
</div></td>
<td width="507" bgcolor="#FFFFFF" height="163"><label>
<textarea name="introduction" cols="60" rows="10" readonly="readonly"><?php echo $row['beizhu'] ?></textarea>
</label></td>
</tr>
</form>
</table>
<p>
</p>
<?php include "foot.php"?>
修改为:
$query="select * from $jiaoshi_table where id='$id'";
总不会在 config.php 或 header.php 里吧?
$n=0;
$query=mysql_query("select count(*) as sm from jiaoshi");
mysql_query("set names 'GB2312'");
$row=mysql_fetch_array($query);
$count=$row['sm'];
if(empty($offset))
{$offset=0;}
echo $offset;
$query=mysql_query("select * from jiaoshi order by teacher asc limit $offset,$list_num") or die ("fail");
mysql_query("set names 'GB2312'");
while($row=mysql_fetch_array($query)){
if(($n%2)!='0'){
echo "<tr bgcolor=#FFFFff>";}
else{
echo "<tr bgcolor=#E4E4E4>";
}
if($row['surplus']==0)
$ss="不可选";
else $ss="可选";
echo"
<td height='22' class='STYLE1'> <div align='center'>".$row['id']."</div></td>
<td height='22'>
<div align='center' class='STYLE1'>".$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>
<td height='22' class='STYLE1'> <div align='center'>".$row['number']."</div></td>
<td height='22' class='STYLE1'> <div align='center'>".$row['xuehao']."</div></td>
<td height='22' class='STYLE1'> <div align='center'>".$ss."</div></td>
<td height='22' class='STYLE1'><div align='center'>
<a href=xiangxiziliao.php?id=".$row['id'].">查看</a></div></td>
</tr> ";
$n++;
}
?>最下边那一行应该就是吧?
至少需要有 $id = $_GET['id']; 才可以
xiangxiziliao.php?id=1然后if(isset($_GET['id'])&&$_GET['id']!=''){
echo $_GET['id'];
}测试下更详细的参考w3school吧
$id = $_GET['id'];
$query="select * from $jiaoshi_table where id='".$id."'";
mysql_query("set names 'GB2312'");
$result=mysql_query($query);
....