本文介绍了如何在PHP中单击下一行显示下一行时,一次显示一行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我正在创建一个页面exam.php这里我想逐一显示问题,当学生在提交问题显示下一个问题后点击下一个。 我尝试过的事情:i am create a page exam.php here i want to show questions one by one mean when student click next after submit question display next question.What I have tried:<?php if(!isset($_SESSION['qno'])) $_SESSION['qno'] = 1; else{ if(isset($_POST['next'])) { $_SESSION['qno'] += 1; } } $sql ="select * from question where question_id= ' ".$_SESSION['qno']." ' "; $query=mysql_query($sql); while($row = mysql_fetch_assoc($query)) { $question =$row['question']; $op1 = $row['option1']; $op2 = $row['option2']; $op3 = $row['option3']; $op4 = $row['option4']; } ?> b $ b 它的工作但是在这段代码中我使用question_id来显示data.problem来自管理员删除一些问题后它无效question_id缺口。 因为我初始化了question_id = 1;那么这个问题的最佳解决方案是什么?its work but in this code i am using question_id to display data.problem come after when admin delete some questions it not working due to question_id gap.because i initialize question_id =1; so what is best solution for this problem?推荐答案 _SESSION [' qno']))_SESSION['qno'])) _SESSION [' qno'] = 1 ; else { if(isset(_SESSION['qno'] = 1; else{ if(isset( _POST [' next'])) {_POST['next'])) { 这篇关于如何在PHP中单击下一行显示下一行时,一次显示一行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-13 17:19