这是显示所有详细信息的页面...此页面名称updatepernternak.php
$ idprofil = $ _GET ['idprofil']; $ result = mysql_query(“SELECT * FROM penternak WHERE id ='$ idprofil'“); $ row = mysql_fetch_array($ result);
&GT?; 无标题文件
“method =”post“> ID : “/> 纳马: “/> 没有I / C: “/> Alamat: “/> “/> Poskod: “/>没有 Telefon Rumah: “/> 没有Telefon Bimbit: “/> E-MEL: “/>
<tr> <td>Nama Projek : </td><td> <label for="nmprojek"></label> <input type="text" name="nmprojek" id="nmprojek" width="539" value="<?php echo $row['nprojek']; ?>"/></td></tr> <tr> <td>Lokasi : </td><td> <label for="lokasi"></label> <textarea name="lokasi" id="lokasi" width="539" col="30" row="6" ><?php echo $row['lokasi']; ?></textarea></td></tr> <tr> <td>Tahun Mula: </td><td> <label for="tmula"></label> <input type="text" name="tmula" id="tmula" width="539" value="<?php echo $row['tmula']; ?>" /></td></tr> </table> <center> <input type="submit" name="submit" value="Kemaskini" /> <input type="reset" /> </center>
然后,如果我点击更新按钮,我将转到此页面名称updatepenternak1.php
&GT?; 无标题文件
&lt;
if($ submit ==“Kemaskini”){$ id = $ _POST [“id”]; $ nama = $ _POST [“nama”]; $ ic = $ _POST [“ic”]; $ lorong1 = $ _POST [“lorong1”]; $ lorong2 = $ _POST [“lorong2”]; $ telrumah = $ _POST [ “telrumah”]; $ henset = $ _POST [“telbimbit”]; $ emel = $ _POST [ “EMEL”]; $ lokasi = $ _POST [“lokasi”]; $ tmula = $ _POST [ “tmula”];
$sql= "UPDATE penternak SET nama ='$nama',ic='$ic', lorong1='$lorong1', lorong2='$lorong2', telrumah='$telrumah',
henset ='$ henset',emel ='$ emel',lokasi ='$ lokasi',tmula ='$ tmula',WHERE id ='$ id'“;
$result = mysql_query($sql); echo "<a href='searchEnt.php' target='parent'>BACK</a>"; }
&GT?;
但我没有错,因为我根本没有更新......有谁可以请帮助我...谢谢......
答案 0 :(得分:0)
试试这个,在更新查询中您在,
子句之前添加了额外的WHERE
。
$sql= "UPDATE penternak SET nama ='$nama',ic='$ic', lorong1='$lorong1', lorong2='$lorong2', telrumah='$telrumah',
henset='$henset', emel='$emel', lokasi='$lokasi', tmula='$tmula' WHERE id = '$id'";