zura08 Posted October 28, 2008 Share Posted October 28, 2008 i already make the sql update code but the data still can't update in database [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/130398-cant-update-the-database/ Share on other sites More sharing options...
MasterACE14 Posted October 28, 2008 Share Posted October 28, 2008 can you post the code here in code tags. And only post the relevant card. Attaching a file is a real big turn off in helping you. Link to comment https://forums.phpfreaks.com/topic/130398-cant-update-the-database/#findComment-676387 Share on other sites More sharing options...
zura08 Posted October 28, 2008 Author Share Posted October 28, 2008 <?php { if (isset($_POST['Kemaskini'])) { $Kod_siri=$_POST['Kod_siri']; $Nama_item=$_POST['Nama_item']; $Kuantiti=$_POST['Kuantiti']; $Tarikh_luput=$_POST['Tarikh_luput']; $Harga=$_POST['Harga']; $Jenis_item=$_POST['Jenis_item']; $Saiz=$_POST['Saiz']; mysql_query("UPDATE stok SET Nama_item='$Nama_item' ,Kuantiti='$Kuantiti', Tarikh_luput='$Tarikh_luput', Harga='$Harga', Jenis_item='$Jenis_item', Saiz='$Saiz' WHERE Kod_siri='$Kod_siri'"); ?> the database can't update. Link to comment https://forums.phpfreaks.com/topic/130398-cant-update-the-database/#findComment-676394 Share on other sites More sharing options...
solon Posted October 28, 2008 Share Posted October 28, 2008 I don't know if that's the problem but try closing the if statement at the end of your update query example: if { ........ } your if statement is still oppen and that might causes the problem Link to comment https://forums.phpfreaks.com/topic/130398-cant-update-the-database/#findComment-676464 Share on other sites More sharing options...
zura08 Posted October 28, 2008 Author Share Posted October 28, 2008 <?php { if (isset($_POST['Kemaskini'])) { $Kod_siri=$_POST['Kod_siri']; $Nama_item=$_POST['Nama_item']; $Kuantiti=$_POST['Kuantiti']; $Tarikh_luput=$_POST['Tarikh_luput']; $Harga=$_POST['Harga']; $Jenis_item=$_POST['Jenis_item']; $Saiz=$_POST['Saiz']; mysql_query("UPDATE stok SET Nama_item='$Nama_item' ,Kuantiti='$Kuantiti', Tarikh_luput='$Tarikh_luput', Harga='$Harga', Jenis_item='$Jenis_item', Saiz='$Saiz' WHERE Kod_siri='$Kod_siri'"); ?> <script> alert("Maklumat berjaya dikemaskini."); location.href="laporan.php"; </script> <? } } } ?> there are no error but the database can't update..who can tell me why... Link to comment https://forums.phpfreaks.com/topic/130398-cant-update-the-database/#findComment-676541 Share on other sites More sharing options...
solon Posted October 28, 2008 Share Posted October 28, 2008 can you post all the code of the page? Link to comment https://forums.phpfreaks.com/topic/130398-cant-update-the-database/#findComment-676543 Share on other sites More sharing options...
zura08 Posted October 28, 2008 Author Share Posted October 28, 2008 <? ob_start(); session_start(); include('db.php'); error_reporting(0); $_SESSION['namaPengguna']=$_SESSION['namaPengguna']; if(isset($_SESSION['Kod_siri'])) { $Kod_siri= $_SESSION['Kod_siri']; $query = "SELECT *FROM stok WHERE Kod_siri='$Kod_siri' "; $result = mysql_query($query); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $Nama_item=$row['Nama_item']; $Kuantiti=$row['Kuantiti']; $Tarikh_luput=$row['Tarikh_luput']; $Harga=$row['Harga']; $Jenis_item=$row['Jenis_item']; $Saiz=$row['Saiz']; } ?> <?php { if (isset($_POST['Kemaskini'])) { $Kod_siri=$_POST['Kod_siri']; $Nama_item=$_POST['Nama_item']; $Kuantiti=$_POST['Kuantiti']; $Tarikh_luput=$_POST['Tarikh_luput']; $Harga=$_POST['Harga']; $Jenis_item=$_POST['Jenis_item']; $Saiz=$_POST['Saiz']; mysql_query("UPDATE stok SET Nama_item='$Nama_item' ,Kuantiti='$Kuantiti', Tarikh_luput='$Tarikh_luput', Harga='$Harga', Jenis_item='$Jenis_item', Saiz='$Saiz' WHERE Kod_siri='$Kod_siri'"); ?> <script> alert("Maklumat berjaya dikemaskini."); location.href="laporan.php"; </script> <? } } } ?> this all the code of this page.. Link to comment https://forums.phpfreaks.com/topic/130398-cant-update-the-database/#findComment-676634 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.