Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- KONEKSI
- <?php
- $host = "localhost";
- $user = "root";
- $password = "";
- $database = "db_ujiana";
- $koneksi = mysql_connect($host,$user,$password);
- $pilihdb = mysql_select_db($database);
- ?>
- ========================================================================
- PENGARANG
- <?php
- include 'koneksi2.php';
- $tabel = "CREATE TABLE tb_pengarang2
- (
- kd_pengarang varchar(4) not null primary key,
- nm_pengarang varchar(35) not null,
- nm_buku varchar(35) not null,
- jk varchar(1) not null,
- tahun varchar(4) not null
- )";
- $isi = "INSERT INTO tb_pengarang2 VALUES
- ('kode1','sarwati','pwe','P','1996'),
- ('kode2','rinto','pbo','L','1984'),
- ('kode3','hendra','visual client','L','2006'),
- ('kode4','atep','kwh','L','1996')";
- $buattb = mysql_query($tabel);
- if (!$buattb)
- {
- echo"ada error".mysql_error();
- }
- else
- {
- mysql_query($isi);
- echo"data berhasil ditambahkan";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement