项目:学生查看自己的作业情况和分数(php)

<?php
include '../includes/db.ini.php';
try
{
$sql='SELECT work_id,title,work_text,score_value
FROM homework;';
$result=$pdo->query($sql);
$cnt=$result->rowCount();
}
catch (PDOExpecyion $e)
{ }
if ($cnt!=0)
{
while($row=$result->fetch())
{
$outputcheck[]=array('work_id'=>$row['work_id'],'title'=>$row['title'],'work_text'=>$row['work_text'],'score_value'=>$row['score_value']);
}
include '../student/checkhomeworkout.php';
}
else
{
echo 'wrong';
exit();
}
?>
<html>
</html>
<head>
</head>
<body>
<?php
foreach ($outputcheck as $out): ?>
<a href="">
<?php echo $out['work_id'].' '.$out['title'].' '.$out['work_text'].' '.$out['score_value'];?></br>
</a>
<?php endforeach;?>
</body>
</html>
上一篇:K8S系列第三篇(Docker网络)


下一篇:003-核心技术-IO模型-NIO-基于NIO群聊示例