我已经使用多个表创建了显示输出的编码,所以我使用了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);
这是编码注释
如果(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')");
以上查询似乎没有功能。我无法将数据保存到数据库。当我点击按钮'保存'没有任何事情发生..
答案 0 :(得分:0)
$query_rsInsert = "INSERT INTO _kursus (remark) VALUES ('$txtadd')
WHERE _kursus.kodkursus = " .$_POST['kodkursus'];