numpang tanya codingan php, error dimana??
Rabu, 11 Januari 2012 by ewepaksa
top custom html 1agan dan sista mohon bantuannya, saya nyoba writing php, untuk fungsi insert dan withdraw didalam satu file (biasa beda file, codenya jalan), tapi saat nyoba ditampilin di htmlnya, fungsiya gak muncul, ini contoh codenya: *ini untuk databasenya* PHP Code: <?php require_once('koneksi.php'); class Supplier { function tampil(){ $sql="select * from supplier ORDER BY idsupplier ASC"; $hasil=mysql_query($sql); return $hasil; } function tambah($idsupplier,$namasupplier,$alamat,$telp){ $input="INSERT INTO supplier (idsupplier,namasupplier,alamat,telp) VALUES ('$idsupplier','$namasupplier','$alamat','$telp')"; $hasil=mysql_query($input); return $hasil; } function hapus (){ $idsupplier=$_POST["idsupplier"]; $sql="delete from supplier where idsupplier='$idsupplier'"; $hasil! =mysql_query($sql); return $hasil; } } ?> ini untuk tampilannya: PHP Code: <?php include ('supplier.php'); $data= new supplier(); ?> <form id="form1" name="form1" method="post" action=""> <table width="300"> <tr> <td width="149"> ID Supplier</td> <td width="149"><input name="idsupplier" type="text" id="idsupplier"/></td> </tr> <tr> <td width="149"> Nama Supplier</td> <td width="149"><input name="namasupplier" type="text" id="namasupplier"/></td> </tr> <tr> <td width="149"> alamat</td> <td width="149"><input name="alamat" type="text" id="alamat"/></td> </tr> <tr> <td width="149"> Telp</td> <td width="149"><input name="telp" type="text" id="telp"/>! 0;/td> </tr> <tr> <td width="100"><input type="submit" name="simpan" value="simpan"/> </td> [color="Red"]<?php $simpan=$data->insert();?>[/color] </tr> </table> </form> <?php $tampil=$data->tampil(); $hapus=$data->hapus(); ?> <table border="1" cellpadding="5" cellspacing="0"> <tr> <td>No</td> <td>Nama</td> <td>Alamat</td> <td>Telp</td> <td>TOOL</td> </tr> <? while ($bt= mysql_fetch_a! rray($tampil)){ echo "<tr>! ; <td> $bt[idsupplier] </td> <td> $bt[namasupplier] </td> <td> $bt[alamat] </td> <td> $bt[telp] </td> <td> [color="Red"]<a href='$hapus?idsupplier=$bt[idsupplier]'>hapus</a> </td>[/color] </tr>" ;} ?> </table> kemungkinan salah ditempat yang saya tandai, untuk manggil fungsinya, kira2 gimana ya? *:malus codenya berantakan, mohon bantuannya gan...bottom custom html 3
Technorati
Technorati
Posting Komentar