<?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>
来源:https://www.cnblogs.com/yangxiaohong/p/5385735.html