-1

我已经为使用多个表的显示输出创建了编码,所以我使用了 Join 函数。但我想添加一个额外的列来插入注释。当我点击保存按钮时,笔记确实保存在数据库中。

- 这是 JOIN 查询的编码。

if(isset($_POST['btnsearch']))
{
    $searchKul=$_POST['txtkul'];
    $searchSem=$_POST['txtsem'];

    if( $searchKul && $searchSem!= NULL)
    {
            $queryKul       =  "SELECT DISTINCT  _kursus.namakur_bm, _kursus.kodkursus, _kulliyah.kod_kul, kur_twr.sesi_sem, exm_penilaian.kod_skema                                                                                                        
                                FROM _kulliyah

                                JOIN _program ON _kulliyah.kod_kul = _program.kod_kul

                                JOIN kur_twr ON _program.kod_prog = kur_twr.kod_prog

                                JOIN _kursus ON kur_twr.kodkursus = _kursus.kodkursus

                                JOIN exm_penilaian ON _kursus.kodkursus = exm_penilaian.kodkursus

                                WHERE _kulliyah.kod_kul LIKE '%$searchKul%'

                                AND kur_twr.sesi_sem LIKE '%$searchSem%'

                                ORDER BY kodkursus";

            $rsKul               = mysql_query($queryKul);
            $row_rsKul           = mysql_fetch_assoc($rsKul);
            $totalRows_rsKul     = mysql_num_rows($rsKul);
  • 这是用于编码说明

    if(isset($_POST['btnsave'])) { $txtadd = $_POST['txtadd'];

                    $result=mysql_query("INSERT INTO _kursus(remark) VALUES('$txtadd')");
    
                    if($result)
                    {
                            echo ("<script language='JavaScript'>alert('Succesfully INSERT data!');</script>
                                   <script language='JavaScript'>window.location='kul7.php';</script>"); 
                    }
                    else 
                    {
                            echo 'PLEASE ENTER AGAIN'; 
                    }
                }?>
                <form action="" method="POST">
                <input type="text" name="txtadd"/><input type="submit" name="btnsave" value="SAVE"/>
                </form>
                <?php 
                "</td>";
                echo "</tr>";
                }
                    while($row_rsKul = mysql_fetch_assoc($rsKul));
                {
                    echo "</table></center>";
                }
                mysql_close();
                }
            }
    

$result=mysql_query("INSERT INTO _kursus(remark) VALUES('$txtadd')");

上面的查询似乎不起作用。我无法将数据保存到数据库。当我单击“保存”按钮时,什么也没有发生..

4

1 回答 1

0
$query_rsInsert = "INSERT INTO _kursus (remark) VALUES ('$txtadd')
                   WHERE _kursus.kodkursus = " .$_POST['kodkursus'];
  • 我如上所述更改编码,但查询不起作用。我想做一些事情,比如当用户添加注释时,注释将根据代码出现保存在数据库中。
于 2012-10-04T02:39:00.920 回答