Advertisement
Guest User

Untitled

a guest
Jan 9th, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. koneksi
  2. <?php
  3. $host = "localhost";
  4. $user = "root";
  5. $password = "";
  6. $database = "db_ujian";
  7.  
  8. $koneksi = mysql_connect($host,$user,$password);
  9. $pilihdb = mysql_select_db($database);
  10.  
  11. ?>
  12.  
  13.  
  14.  
  15.  
  16. pengarang
  17. <?php
  18. include 'koneksi.php';
  19.  
  20.  
  21. $table = "CREATE TABLE tb_pengarang(
  22. kode_pengarang varchar (6) primary key,
  23. nama_pengarang varchar (35) not null,
  24. nama_buku varchar (50) not null,
  25. jeniskelamin enum ('P','L'),
  26. tahunterbit varchar (6) not null)";
  27.  
  28. $isi = "INSERT INTO tb_pengarang VALUES
  29. ('0001','abu hanafi','sejarah','L','1998'),
  30. ('0002','rikky','mtk','L','2010'),
  31. ('0003','adam','geo','L','2003'),
  32. ('0004','fadhil','inggris','L','2009'),
  33. ('0005','diky','indonesia','L','1997')";
  34.  
  35.  
  36. $buat_table = mysql_query($table);
  37. if(!$buat_table){
  38. echo "gagal";
  39. }
  40. else{
  41. $isi_table = mysql_query($isi);
  42. }
  43.  
  44.  
  45.  
  46. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement