Php Can';t在父页中查看表,但在单页中查看它';他在工作
我在做一个学校系统,让家长可以查看他们孩子的分数。但问题是,我无法查看表分数,以便家长在系统中查看其子女的分数。该页面可以作为管理员顺利查看,并且单个页面(parent_view_score.php)工作正常。我不知道是什么问题,因为我一直在调试页面,奇怪的是它没有在系统中显示表 唯一与管理员不同的是,管理员可以添加、编辑和删除分数。而家长只能查看孩子的分数 我想这可能是标签页的问题,但我在代码中找不到错误 该表不会显示在Php Can';t在父页中查看表,但在单页中查看它';他在工作,php,html,mysql,html-table,Php,Html,Mysql,Html Table,我在做一个学校系统,让家长可以查看他们孩子的分数。但问题是,我无法查看表分数,以便家长在系统中查看其子女的分数。该页面可以作为管理员顺利查看,并且单个页面(parent_view_score.php)工作正常。我不知道是什么问题,因为我一直在调试页面,奇怪的是它没有在系统中显示表 唯一与管理员不同的是,管理员可以添加、编辑和删除分数。而家长只能查看孩子的分数 我想这可能是标签页的问题,但我在代码中找不到错误 该表不会显示在parent.php?tag=parent\u view\u scores
parent.php?tag=parent\u view\u scores
但是如果parent\u view\u scores.php
将正确显示表格和数据
<?php
session_start();
require("connect.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="css/style_view.css" />
<title>My PIBG</title>
</head>
<body>
<div id="style_div" >
<form method="post">
<table width="755">
<tr>
<td width="190px" style="font-size:18px; color:#006; text-indent:30px;">View Scores</td>
</tr>
</table>
</form>
</div>
<br />
<div id="content-input">
<form method="post">
<table border="1" width="1050px" align="center" cellpadding="3" class="mytable" cellspacing="0">
<tr>
<th>No</th>
<th>Students Name</th>
<th>Class Name</th>
<th>Subject Name </th>
<th>MidTerm</th>
<th>Final</th>
<th>Note</th>
</tr>
<?php
$sql_sel=mysql_query("SELECT DISTINCT A.stu_name, A.class_name, sub_name, midterm, final, note FROM stu_score_tbl A, stu_tbl B, users_tbl C WHERE A.stu_name = B.stu_name AND B.parent_ic = C.icnum AND C.username = '{$_SESSION['username']}'");
if($sql_sel === FALSE) {
die('could not get data'.mysql_error()); }
$i=0;
while($row=mysql_fetch_array($sql_sel)){
$i++;
$color=($i%2==0)?"lightblue":"white";
?>
<tr bgcolor="<?php echo $color?>">
<td><?php echo $i;?></td>
<td><?php echo $row['stu_name'];?></td>
<td><?php echo $row['class_name'];?></td>
<td><?php echo $row['sub_name'];?></td>
<td><?php echo $row['midterm'];?></td>
<td><?php echo $row['final'];?></td>
<td><?php echo $row['note'];?></td>
</tr>
<?php
}
?>
</table>
</form>
</div>
</body>
</html>
我的PIBG
查看分数
不
学生姓名
类名
主题名称
期中考试
最终的
注
如何使用此页面连接到数据库,看不到包含或连接?mysql已弃用且不安全,您应该查看mysqli或PHP PDO以了解安全性。我使用了connect.PHP my connect.PHP,要么我完全失明,要么您错过了上面脚本中的连接代码。另外,不要忘了清理(mysql\u real\u escape\u string)sql字符串中的输入值。理想情况下,尽量不要使用mysql_*函数,而是使用PDO。