Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/59.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 对于循环+;插入了错误的记录_Php_Mysql_Sql Update - Fatal编程技术网

Php 对于循环+;插入了错误的记录

Php 对于循环+;插入了错误的记录,php,mysql,sql-update,Php,Mysql,Sql Update,您好,我有一个有Subc_ID的表单。下面是一个场景。我有subsu_id 1、2、3、4、6,但每次提交表单时会发生什么情况?它会插入一个值为0加上它不会插入subsu_id为6的记录 表格: <tr> <td width="225"><?= $row_subjects[1];?> <?php if($row_active_term[0] == '1st' && $row_active_term[

您好,我有一个有Subc_ID的表单。下面是一个场景。我有subsu_id 1、2、3、4、6,但每次提交表单时会发生什么情况?它会插入一个值为0加上它不会插入subsu_id为6的记录

表格:

    <tr>
        <td width="225"><?= $row_subjects[1];?>
        <?php if($row_active_term[0] == '1st' && $row_active_term[1] == '1' ) {?>
        <td align="center"  width="225">
            <?php if($row_subjects['indicator'] == 'editable'){?>
                <input type="hidden" name="subj_id_<?= $row_subjects[0]?>" id="subj_id_<?= $row_subjects[0]?>" value="<?= $row_subjects[0]?>" />
                <input type="text" name="grade_<?= $row_subjects[0]?>" id="grade_<?= $row_subjects[0]?>" size="5" value="<?= number_format($row_subjects[4], 1)?>" />
            <?php } else {?>
                <a href="#" title="This is your downfall">?</a>
            <?php } ?>
        </td>
        <?php } ?>
    </tr>


假设$x等于6

for($i=0; $i<=$x; $i++) {
对于($i=0;$i一基还是零基?

我想你有一个循环,它在最后一条记录之前终止?

如果你不接受答案,我没有动力帮助你。你知道mysql注入的风险吗?我的问题不是mysql注入,因为这只是一个本地应用程序……我不知道我应该正确地依赖Subc id,但我在计算我的for循环数这将是一个最长的周期,但它并没有引导我走上正确的轨道…是的,你说的对…但主要的问题还没有回答。这是什么?为什么x是5或者为什么x是6,但你仍然没有看到插入的最后一条记录?如果你的id是作为记录0=>ID1,记录1=>ID2,等等存储在你的数据库中($i=0;$i)
for($i=0; $i<=$x; $i++) {
for($i=1; $i <= $x; $i++) {