Advertisement
Guest User

Untitled

a guest
Jan 9th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. KONEKSI
  2. <?php
  3. $host = "localhost";
  4. $user = "root";
  5. $password = "";
  6. $database = "db_ujiana";
  7.  
  8. $koneksi = mysql_connect($host,$user,$password);
  9. $pilihdb = mysql_select_db($database);
  10.  
  11. ?>
  12. ========================================================================
  13. PENGARANG
  14. <?php
  15. include 'koneksi2.php';
  16.  
  17. $tabel = "CREATE TABLE tb_pengarang2
  18. (
  19. kd_pengarang varchar(4) not null primary key,
  20. nm_pengarang varchar(35) not null,
  21. nm_buku varchar(35) not null,
  22. jk varchar(1) not null,
  23. tahun varchar(4) not null
  24. )";
  25.  
  26. $isi = "INSERT INTO tb_pengarang2 VALUES
  27. ('kode1','sarwati','pwe','P','1996'),
  28. ('kode2','rinto','pbo','L','1984'),
  29. ('kode3','hendra','visual client','L','2006'),
  30. ('kode4','atep','kwh','L','1996')";
  31.  
  32. $buattb = mysql_query($tabel);
  33. if (!$buattb)
  34. {
  35. echo"ada error".mysql_error();
  36. }
  37. else
  38. {
  39. mysql_query($isi);
  40. echo"data berhasil ditambahkan";
  41. }
  42. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement