Ceriwis  

Go Back   Ceriwis > HOBI > Komputer & Teknologi > Programming

Programming Share, tanya jawab, saling bantu antar programmer dengan berbagai macam bahasa pemrograman.

Reply
 
Thread Tools
  #1  
Old 20th November 2011
SinggahDapur SinggahDapur is offline
Ceriwiser
 
Join Date: Nov 2011
Posts: 348
Rep Power: 14
SinggahDapur mempunyai hidup yang Normal
Default bagaimana cara membuat query update 3 table sekaligus

salam semuanya... numpang tanya gan....



kek mana ya query mysql untuk update multitable...



ne table ane...



1.
PHP Code:




CREATE TABLE IF NOT EXISTS `st` (

`
idst` int(11) NOT NULL AUTO_INCREMENT,

`
nost` varchar(20) NOT NULL,

`
tglst` varchar(11) NOT NULL,

`
namatim` varchar(225) NOT NULL,

PRIMARY KEY (`idst`)

)
ENGINE=MyISAM DEFAULT CHARSET=latin1







2.
PHP Code:




CREATE TABLE IF NOT EXISTS `laporan` (

`
idlap` int(11) NOT NULL AUTO_INCREMENT,

`
namalap` text NOT NULL,

`
nolap` varchar(30) NOT NULL,

`
tgllap` varchar(12) NOT NULL,

`
tahun` int(4) NOT NULL,

PRIMARY KEY (`idlap`)

)
ENGINE=MyISAM DEFAULT CHARSET=latin1







3.
PHP Code:




CREATE TABLE IF NOT EXISTS `proggres` (

`
idprog` int(11) NOT NULL AUTO_INCREMENT,

`
sp` varchar(1) DEFAULT NULL,

`
dl1` varchar(1) DEFAULT NULL,

`
dl2` varchar(1) DEFAULT NULL,

`
dl3` varchar(1) DEFAULT NULL,

`
dl4` varchar(1) DEFAULT NULL,

`
kaper` varchar(1) DEFAULT NULL,

`
cetak` varchar(1) DEFAULT NULL,

PRIMARY KEY (`idprog`)

)
ENGINE=MyISAM DEFAULT CHARSET=latin1







ene dah coba query seperti ini, tapi gak bisa terupdate..




PHP Code:




$query ="UPDATE st, proggres, laporan SET nost='$nost', tglst='$tglst', namatim='$namatim', sp='$sp', dl1='$dl1', dl2='$dl2', dl3='$dl3', dl4='$dl4', kaper='$kaper', cetak='$cetak', namalap='$namalap', nolap='$nolap', tgllap='$tgllap', tahun='$tahun' WHERE (st.idst=proggres.idprog) AND (st.idst='$idst')";

mysql_query($query) or die("Data Gagal Dimasukkan: ".mysql_error());







...



kira-kira scrib ane salahnya dimana ya...

terima kasih sebelumnya...



Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


 


All times are GMT +7. The time now is 08:03 AM.


no new posts