如何使用while循环获取所有id

时间:2017-03-06 19:45:36

标签: php while-loop fetch

我在这里有一个问题

如何从上一页获取所有ID并使用while循环将它们带到下一页

这是我的第一页:

        <?php
        $result = mysql_query("SELECT * FROM grades_information JOIN student_information ON grades_information.student_information_id=student_information.student_information_id WHERE grades_information.subject_code='$subject_code'");
        while($row = mysql_fetch_array($result))
        {
            echo '<tr>';
        $student_numero = $row['student_information_id'];
        $grade_q1 = $row['grade_q1'];
        $grade_q2 = $row['grade_q2'];
        $grade_q3 = $row['grade_q3'];
        $grade_q4 = $row['grade_q4'];
        $final = $grade_q1 + $grade_q2 + $grade_q3 + $grade_q4;
            echo "<input type=\"hidden\" name=\"stud_number\" value=\"$student_numero\">";
            echo'<td><div align="left">'.$row['student_lastname'].','.$row['student_firstname'].' '.$row['student_middlename'] .'</div></td>';
            echo"<td><div align=\"center\"><input type=\"text3\" minlength=\"2\" maxlength=\"5\" size=\"5\" name=\"grade_q1\" value=\"$grade_q1\"". (($subj_status = 'not for encoding'  && $date > $to1_quarter1 || $date < $from1_quarter1) ? "readonly" : "") . "></div></td>";
            echo"<td><div align=\"center\"><input type=\"text3\" minlength=\"2\" maxlength=\"5\" size=\"5\" name=\"grade_q2\" value=\"$grade_q2\"". (($subj_status = 'not for encoding'  && $date > $to2_quarter2 || $date < $from2_quarter2) ? "readonly" : "") . "></div></td>";
            echo"<td><div align=\"center\"><input type=\"text3\" minlength=\"2\" maxlength=\"5\" size=\"5\" name=\"grade_q3\" value=\"$grade_q3\"". (($subj_status = 'not for encoding'  && $date > $to3_quarter3 || $date < $from3_quarter3) ? "readonly" : "") . "></div></td>";
            echo"<td><div align=\"center\"><input type=\"text3\" minlength=\"2\" maxlength=\"5\" size=\"5\" name=\"grade_q4\" value=\"$grade_q4\"". (($subj_status = 'not for encoding'  && $date > $to4_quarter4 || $date < $from4_quarter4) ? "readonly" : "") . "></div></td>";
            echo'</tr>';
        }
        ?>  

这是我目前获取id

的代码
$stud_number = $_POST['stud_number'];
$section_name = $_POST['section_name'];
$subject_code = $_POST['subject_code'];
$employee_number = $_POST['employee_number'];
$curriculum_year = $_POST['curriculum_year'];
$grade_q1 = $_POST['grade_q1'];
$grade_q2 = $_POST['grade_q2'];
$grade_q3 = $_POST['grade_q3'];
$grade_q4 = $_POST['grade_q4'];

现在我只得到一个身份

感谢您的帮助

0 个答案:

没有答案