SlideShare uma empresa Scribd logo
1 de 29
By I Wayan Simpen Pemrograman Web II With MySql (Kont.)
Fungsi-fungsi MySql ,[object Object],[object Object],Membuat hubungan ke database MySQL yang terdapat pada suatu host. mysql_connect  ( host, nama_user, password )
Fungsi-fungsi MySql (Kont.) ,[object Object],<?php  $nama_server = &quot;localhost&quot;; $nama_user = &quot;root&quot;; $password = &quot;&quot;; $database = &quot;Perpus&quot;; $id_mysql= mysql_connect ($nama_server,$nama_user,$password); if(! $id_mysql) die(&quot;Database MySQL tak dapat dibuka&quot;); if (! mysql_select_db($database,$id_mysql)) die(&quot;Database tak dalat dipilih&quot;); ?>
Fungsi-fungsi MySql (Kont.) ,[object Object],[object Object],Mengeksekusi permintaan (query) terhadap sebuah table atau sejumlah table.  mysql_query ( permintaan, pengenal_hubungan )
Fungsi-fungsi MySql (Kont.) ,[object Object],<?php  $nama_server = &quot;localhost&quot;; $nama_user = &quot;root&quot;; $password = &quot;&quot;; $database = &quot;Perpus&quot;; $id_mysql= mysql_connect ($nama_server,$nama_user,$password); if(! $id_mysql) die(&quot;Database MySQL tak dapat dibuka&quot;); if (! mysql_select_db($database,$id_mysql)) die(&quot;Database tak dalat dipilih&quot;); $hasil= mysql_query (&quot;SELECT nktlg, judul from buku order by judul&quot;,$id_mysql); ?>
Fungsi-fungsi MySql (Kont.) ,[object Object],[object Object],Menjalankan suatu permintaan terhadap suatu database  mysql_db_query  ( databases, permintaan,  pengenal_hubungan )
Fungsi-fungsi MySql (Kont.) ,[object Object],<?php  $nama_server = &quot;localhost&quot;; $nama_user = &quot;root&quot;; $password = &quot;&quot;; $database = &quot;Perpus&quot;; $id_mysql= mysql_connect ($nama_server,$nama_user,$password); if(! $id_mysql) die(&quot;Database MySQL tak dapat dibuka&quot;); if (! mysql_select_db($database,$id_mysql)) die(&quot;Database tak dalat dipilih&quot;); $query=&quot;SELECT nktlg, judul from buku order by judul&quot;; $hasil= mysql_db_query ($database,$query,$id_mysql); ?>
Fungsi-fungsi MySql (Kont.) ,[object Object],[object Object],Memperoleh jumlah baris dari suatu hasil permintaan (query) yang menggunakan SELECT.  mysql_num_rows  ( pengenal_hasil )
Fungsi-fungsi MySql (Kont.) ,[object Object],<?php  $nama_server = &quot;localhost&quot;; $nama_user = &quot;root&quot;; $password = &quot;&quot;; $database = &quot;Perpus&quot;; $id_mysql= mysql_connect ($nama_server,$nama_user,$password); if(! $id_mysql) die(&quot;Database MySQL tak dapat dibuka&quot;); if (! mysql_select_db($database,$id_mysql)) die(&quot;Database tak dalat dipilih&quot;); $query=&quot;SELECT nktlg, judul from buku order by judul&quot;; $hasil= mysql_query ($query,$id_mysql); $jbaris= mysql_num_rows ($hasil); ?>
Fungsi-fungsi MySql (Kont.) ,[object Object],[object Object],Memperoleh jumlah baris yang menggunakan operasi (query) INSERT, DELETE, dan UPDATE.  mysql_affected_rows  ( pengenal_hasil )
Fungsi-fungsi MySql (Kont.) ,[object Object],include (&quot;conect.inc.php&quot;); $query = &quot;UPDATE buku  SET kdpeng = '$kdpeng', &quot; . &quot;kdpen = '$kdpen', judul = '$judul', Tahun = '$thn' &quot; . &quot;jumlah = '$jml' WHERE nktlg = '$nktlg'&quot;; $hasil= mysql_query ($query, $id_mysql); $baris= mysql_affected_rows ($hasil);
Fungsi-fungsi MySql (Kont.) ,[object Object],[object Object],Memperoleh jumlah kolom pada suatu hasil permintaan  (query).  mysql_num_fields  ( pengenal_hasil )
Fungsi-fungsi MySql (Kont.) ,[object Object],include (&quot;conect.inc.php&quot;); $query = “SELECT * FROM BUKU &quot;; $hasil= mysql_query ($query, $id_mysql); $kolom= mysql_num_fields ($hasil); Kolom=8 BUKU
Fungsi-fungsi MySql (Kont.) ,[object Object],[object Object],Membentuk suatu  array  yang berisi kolom dari sebuah baris pada suatu himpunan hasil.  mysql_fetch_row  ( pengenal_hasil )
Fungsi-fungsi MySql (Kont.) ,[object Object],include &quot;conect.inc.php&quot;; $hasil =  mysql_query  ( &quot;SELECT * FROM buku WHERE nktlg = '$nktlg'&quot;,$id_mysql); $baris =  mysql_fetch_row ($hasil); if ($baris == FALSE) die(&quot;Tak ada data yang memenuhi&quot;); $nktlg  = $baris[0]; $judul = $baris[1]; $kdklas = $baris[2]; $kdpeng  = $baris[3]; $kdpen  = $baris[4]; $tahun  = $baris[5]; $jml = $baris[6];
Fungsi-fungsi MySql (Kont.) ,[object Object],[object Object],Mempunyai kegunaan sama dengan  mysql_fetch_row , hanya saja setiap kolom disimpan dua kali pada array hasil.  mysql_fetch_array ( pengenal_hasil )
Fungsi-fungsi MySql (Kont.) ,[object Object],[object Object],Memindahkan pointer pada suatu himpunan hasil supaya menunjuk ke baris tertentu.  mysql_data_seek ( pengenal_hasil,nomor_baris )
Contoh Selengkapnya (Studi Kasus) ,[object Object],[object Object],[object Object],[object Object],[object Object]
Umum.inc <?php $nama_server = &quot;localhost&quot;; $nama_user = &quot;root&quot;; $password = &quot;&quot;; $database = &quot;perpus&quot;; function header_dinamis() { header(&quot;Expires: 10 Desember 2004 17:00:00 GMT&quot;); header(&quot;Last-Modified:&quot;. gmdate(&quot;D, d M Y M:i:s&quot;)); if ($SERVER_PROTOCOL == &quot;HTTP/0.1&quot;)   header(&quot;Pragma: no-cache&quot;); else   header(&quot;Cache-Control: no-cache, must-revalidate&quot;); } ?>
Connet.inc.php <?php  $nama_server = &quot;localhost&quot;; $nama_user = &quot;root&quot;; $password = &quot;&quot;; $database = &quot;Perpus&quot;; $id_mysql=mysql_connect($nama_server,$nama_user,$password); if(! $id_mysql) die(&quot;Database MySQL tak dapat dibuka&quot;); if (! mysql_select_db($database,$id_mysql)) die(&quot;Database tak dalat dipilih&quot;); ?>
Otentik.inc <?php include &quot;umum.inc&quot;; function otentikasi($pemakai, $sandi) { global $nama_server, $nama_user, $password, $database; $id_mysql=mysql_pconnect($nama_sever, $nama_user, $password);  if (! $id_mysql) return FALSE; if (! mysql_select_db($database, $id_mysql)) return  FALSE; $hasil=mysql_query(&quot;SELECT * from user where STB='$pemakai'&quot;,$id_mysql);
Otentik.inc <?php include &quot;umum.inc&quot;; function otentikasi($pemakai, $sandi) { global $nama_server, $nama_user, $password, $database; $id_mysql=mysql_pconnect($nama_sever, $nama_user, $password);  if (! $id_mysql) return FALSE; if (! mysql_select_db($database, $id_mysql)) return  FALSE; $hasil=mysql_query(&quot;SELECT * from user where stb='$pemakai'&quot;,$id_mysql);
Otentik.inc (Kont.) if (! $hasil)  return FALSE; $baris=mysql_fetch_row($hasil); $pass1=substr(md5($sandi),0,10); if ($baris[1]==$pass1) { return TRUE; } else { return FALSE;  } } ?>
Entri Pengarang (pengar.php)
Entri Pengarang (pengar.php)  Kont. <?php include &quot;otentik.inc&quot;;  session_start(); $sesi_user=$_SESSION[&quot;sesi_user&quot;]; $sesi_pass=$_SESSION[&quot;sesi_pass&quot;]; if (! otentikasi($sesi_user,$sesi_pass)) { header('WWW-Authenticate: Basic realm=&quot;Authentication System&quot;'); header('HTTP/1.0 401 Unauthorized'); echo &quot;You must enter a valid login ID and password to access this resource&quot;; exit(); } ?>
Entri Pengarang (pengar.php)  Kont. <html><head><title>Kota</title></head> <body bgcolor=&quot;#F5F5F5&quot;> <table border=&quot;5&quot; align=&quot;center&quot;> <th>PENGARANG BUKU</th> <tr><td> <form method=&quot;post&quot; action=&quot; save.pengar.php &quot;> <table> <tr> <td>Kode Pengarang</td> <td> <input type=&quot;text&quot; size=&quot;4&quot; name=&quot;kdpeng&quot; maxlength=&quot;4&quot;></td> </tr> <tr> <td>Nama Pengarang</td> <td> <input type=&quot;text&quot; size=&quot;35&quot; name=&quot;nmpeng&quot;></td> </tr> <tr> <td colspan=2 align=&quot;center&quot;><input type=&quot;submit&quot; value=&quot;Rekam&quot;>&nbsp;&nbsp;&nbsp;&nbsp <input type=&quot;Reset&quot; value=&quot;Batal&quot;></td> </tr> </table></form></td></tr></table> </body></html>
Save.pengar.php <html><body> <table border=1 align=&quot;center&quot;><tr><td align=&quot;center&quot;> <?php $kdpeng=$_POST['kdpeng']; $nmpeng=$_POST['nmpeng']; if (empty($kdpeng) or empty($nmpeng)) { print(&quot;<b><font color=red>Maaf</font></b><br>&quot;); print(&quot;Data <b>Pengarang</b> gagal diposting karena Tidak Lengkap</td>&quot;); print(&quot;<tr><td align=center><br><a href=amp;quot;pengar.phpamp;quot;>Kembali ke Entri Pengarang</a><br></td><tr></table>&quot;); exit(); } include(&quot;conect.inc.php&quot;); $query=&quot;INSERT INTO pengarang (kdpeng,nmpeng) VALUES  ('$kdpeng','$nmpeng')&quot;;
Save.pengar.php (Kont.) mysql_query ($query, $id_mysql); if ( mysql_affected_rows () >0) { print(&quot;Selamat<br>&quot;); print(&quot;Pengarang $nmpeng Telah SUKSES diCatat&quot;); } else { print(&quot;<font color=red>M a a f: Perekaman</font><br>&quot;); print(&quot;<br> Kode Pengarang = $kdpeng&quot;); print(&quot;<br> Nama Pengarang = $nmpeng<br><br>&quot;); print(&quot;Gagal dilakukan<br>&quot;); } mysql_close ($id_mysql); ?> <br><a href=&quot;pengar.php&quot;>Kembali ke Entri Pengarang</a> </td></tr></table> </body> </html>
SAMPAI JUMPA Di FINAL TEST TERIMAKASIH

Mais conteúdo relacionado

Mais procurados

jQuery - Javascript para quem não sabe Javascript
jQuery - Javascript para quem não sabe JavascriptjQuery - Javascript para quem não sabe Javascript
jQuery - Javascript para quem não sabe JavascriptNando Vieira
 
Palestra sobre MongoDB com PHP no PHP'n'Rio
Palestra sobre MongoDB com PHP no PHP'n'Rio Palestra sobre MongoDB com PHP no PHP'n'Rio
Palestra sobre MongoDB com PHP no PHP'n'Rio Suissa
 
Introduction to Service Worker
Introduction to Service WorkerIntroduction to Service Worker
Introduction to Service WorkerShogo Sensui
 
MySQL Э.Насанжаргал
MySQL Э.НасанжаргалMySQL Э.Насанжаргал
MySQL Э.НасанжаргалSingleton
 
Як досвід компанії перетворився на фреймворк
Як досвід компанії перетворився на фреймворкЯк досвід компанії перетворився на фреймворк
Як досвід компанії перетворився на фреймворкShtrih Sruleg
 
Analizador sintáctico de Pascal escrito en Bison
Analizador sintáctico de Pascal escrito en BisonAnalizador sintáctico de Pascal escrito en Bison
Analizador sintáctico de Pascal escrito en BisonEgdares Futch H.
 
Jquery Introduction Hebrew
Jquery Introduction HebrewJquery Introduction Hebrew
Jquery Introduction HebrewAlex Ivy
 
ສ້າງລະບົບ Loin ດ້ວຍ php
ສ້າງລະບົບ Loin ດ້ວຍ phpສ້າງລະບົບ Loin ດ້ວຍ php
ສ້າງລະບົບ Loin ດ້ວຍ phpBounsong Byv
 
Simular un next del recordset en php de forma rudimentaria
Simular un next del recordset en php de forma rudimentariaSimular un next del recordset en php de forma rudimentaria
Simular un next del recordset en php de forma rudimentariajbersosa
 
Quiz Component For Joomla
Quiz Component For JoomlaQuiz Component For Joomla
Quiz Component For Joomlaguestebb21a
 
Symfony2でMongoDBと仲良くする方法
Symfony2でMongoDBと仲良くする方法Symfony2でMongoDBと仲良くする方法
Symfony2でMongoDBと仲良くする方法Koji Iwazaki
 
Sumahexavector
SumahexavectorSumahexavector
Sumahexavectorjbersosa
 
アプリ設定の保存をシンプルに
アプリ設定の保存をシンプルにアプリ設定の保存をシンプルに
アプリ設定の保存をシンプルにsusan335
 

Mais procurados (20)

Sis quiz
Sis quizSis quiz
Sis quiz
 
Introducción a Bolt
Introducción a BoltIntroducción a Bolt
Introducción a Bolt
 
With enter
With enterWith enter
With enter
 
jQuery - Javascript para quem não sabe Javascript
jQuery - Javascript para quem não sabe JavascriptjQuery - Javascript para quem não sabe Javascript
jQuery - Javascript para quem não sabe Javascript
 
Palestra sobre MongoDB com PHP no PHP'n'Rio
Palestra sobre MongoDB com PHP no PHP'n'Rio Palestra sobre MongoDB com PHP no PHP'n'Rio
Palestra sobre MongoDB com PHP no PHP'n'Rio
 
Introduction to Service Worker
Introduction to Service WorkerIntroduction to Service Worker
Introduction to Service Worker
 
MySQL Э.Насанжаргал
MySQL Э.НасанжаргалMySQL Э.Насанжаргал
MySQL Э.Насанжаргал
 
Як досвід компанії перетворився на фреймворк
Як досвід компанії перетворився на фреймворкЯк досвід компанії перетворився на фреймворк
Як досвід компанії перетворився на фреймворк
 
Analizador sintáctico de Pascal escrito en Bison
Analizador sintáctico de Pascal escrito en BisonAnalizador sintáctico de Pascal escrito en Bison
Analizador sintáctico de Pascal escrito en Bison
 
Jquery Introduction Hebrew
Jquery Introduction HebrewJquery Introduction Hebrew
Jquery Introduction Hebrew
 
ສ້າງລະບົບ Loin ດ້ວຍ php
ສ້າງລະບົບ Loin ດ້ວຍ phpສ້າງລະບົບ Loin ດ້ວຍ php
ສ້າງລະບົບ Loin ດ້ວຍ php
 
Simular un next del recordset en php de forma rudimentaria
Simular un next del recordset en php de forma rudimentariaSimular un next del recordset en php de forma rudimentaria
Simular un next del recordset en php de forma rudimentaria
 
Quiz Component For Joomla
Quiz Component For JoomlaQuiz Component For Joomla
Quiz Component For Joomla
 
Symfony2でMongoDBと仲良くする方法
Symfony2でMongoDBと仲良くする方法Symfony2でMongoDBと仲良くする方法
Symfony2でMongoDBと仲良くする方法
 
Silex al límite
Silex al límiteSilex al límite
Silex al límite
 
es6.concurrency()
es6.concurrency()es6.concurrency()
es6.concurrency()
 
Phpex3
Phpex3Phpex3
Phpex3
 
Sumahexavector
SumahexavectorSumahexavector
Sumahexavector
 
アプリ設定の保存をシンプルに
アプリ設定の保存をシンプルにアプリ設定の保存をシンプルに
アプリ設定の保存をシンプルに
 
jQuery入門
jQuery入門jQuery入門
jQuery入門
 

Destaque

Public Share Folder - Presentacion
Public Share Folder  -  PresentacionPublic Share Folder  -  Presentacion
Public Share Folder - PresentacionXavi Gutierrez
 
หลักสูตรประกาศนียบัตรวิชาชีพชั้นสูง
หลักสูตรประกาศนียบัตรวิชาชีพชั้นสูงหลักสูตรประกาศนียบัตรวิชาชีพชั้นสูง
หลักสูตรประกาศนียบัตรวิชาชีพชั้นสูงMaxky Thonchan
 
Content en de migratiemonsters
Content en de migratiemonstersContent en de migratiemonsters
Content en de migratiemonstersIlse Jonker
 
Saukon Taivaspaikka ja Creative Commons
Saukon Taivaspaikka ja Creative CommonsSaukon Taivaspaikka ja Creative Commons
Saukon Taivaspaikka ja Creative CommonsLinda Saukko-Rauta
 

Destaque (8)

Public Share Folder - Presentacion
Public Share Folder  -  PresentacionPublic Share Folder  -  Presentacion
Public Share Folder - Presentacion
 
WEB II PHP 10 odbc 1
WEB II PHP 10 odbc 1WEB II PHP 10 odbc 1
WEB II PHP 10 odbc 1
 
หลักสูตรประกาศนียบัตรวิชาชีพชั้นสูง
หลักสูตรประกาศนียบัตรวิชาชีพชั้นสูงหลักสูตรประกาศนียบัตรวิชาชีพชั้นสูง
หลักสูตรประกาศนียบัตรวิชาชีพชั้นสูง
 
Nacela zdravog zivota
Nacela zdravog zivotaNacela zdravog zivota
Nacela zdravog zivota
 
信息 Sunday Sermon 14/08/2011
信息 Sunday Sermon 14/08/2011信息 Sunday Sermon 14/08/2011
信息 Sunday Sermon 14/08/2011
 
Content en de migratiemonsters
Content en de migratiemonstersContent en de migratiemonsters
Content en de migratiemonsters
 
Saukon Taivaspaikka ja Creative Commons
Saukon Taivaspaikka ja Creative CommonsSaukon Taivaspaikka ja Creative Commons
Saukon Taivaspaikka ja Creative Commons
 
WEB II PHP 11 odbc 2
WEB II PHP 11 odbc 2WEB II PHP 11 odbc 2
WEB II PHP 11 odbc 2
 

Mais de Rani Sarungallo Rombe (9)

WEB II PHP 09 text
WEB II PHP 09 textWEB II PHP 09 text
WEB II PHP 09 text
 
WEB II PHP 07
WEB II PHP 07WEB II PHP 07
WEB II PHP 07
 
WEB II PHP 06.ppt
WEB II PHP 06.pptWEB II PHP 06.ppt
WEB II PHP 06.ppt
 
WEB II PHP 06
WEB II PHP 06WEB II PHP 06
WEB II PHP 06
 
WEB II PHP 05
WEB II PHP 05WEB II PHP 05
WEB II PHP 05
 
WEB II PHP 04
WEB II PHP 04WEB II PHP 04
WEB II PHP 04
 
WEB II PHP 03
WEB II PHP 03WEB II PHP 03
WEB II PHP 03
 
WEB II PHP 02
WEB II PHP 02WEB II PHP 02
WEB II PHP 02
 
WEB II PHP 01
WEB II PHP 01WEB II PHP 01
WEB II PHP 01
 

Wek14 mysql 2

  • 1. By I Wayan Simpen Pemrograman Web II With MySql (Kont.)
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19. Umum.inc <?php $nama_server = &quot;localhost&quot;; $nama_user = &quot;root&quot;; $password = &quot;&quot;; $database = &quot;perpus&quot;; function header_dinamis() { header(&quot;Expires: 10 Desember 2004 17:00:00 GMT&quot;); header(&quot;Last-Modified:&quot;. gmdate(&quot;D, d M Y M:i:s&quot;)); if ($SERVER_PROTOCOL == &quot;HTTP/0.1&quot;) header(&quot;Pragma: no-cache&quot;); else header(&quot;Cache-Control: no-cache, must-revalidate&quot;); } ?>
  • 20. Connet.inc.php <?php $nama_server = &quot;localhost&quot;; $nama_user = &quot;root&quot;; $password = &quot;&quot;; $database = &quot;Perpus&quot;; $id_mysql=mysql_connect($nama_server,$nama_user,$password); if(! $id_mysql) die(&quot;Database MySQL tak dapat dibuka&quot;); if (! mysql_select_db($database,$id_mysql)) die(&quot;Database tak dalat dipilih&quot;); ?>
  • 21. Otentik.inc <?php include &quot;umum.inc&quot;; function otentikasi($pemakai, $sandi) { global $nama_server, $nama_user, $password, $database; $id_mysql=mysql_pconnect($nama_sever, $nama_user, $password); if (! $id_mysql) return FALSE; if (! mysql_select_db($database, $id_mysql)) return FALSE; $hasil=mysql_query(&quot;SELECT * from user where STB='$pemakai'&quot;,$id_mysql);
  • 22. Otentik.inc <?php include &quot;umum.inc&quot;; function otentikasi($pemakai, $sandi) { global $nama_server, $nama_user, $password, $database; $id_mysql=mysql_pconnect($nama_sever, $nama_user, $password); if (! $id_mysql) return FALSE; if (! mysql_select_db($database, $id_mysql)) return FALSE; $hasil=mysql_query(&quot;SELECT * from user where stb='$pemakai'&quot;,$id_mysql);
  • 23. Otentik.inc (Kont.) if (! $hasil) return FALSE; $baris=mysql_fetch_row($hasil); $pass1=substr(md5($sandi),0,10); if ($baris[1]==$pass1) { return TRUE; } else { return FALSE; } } ?>
  • 25. Entri Pengarang (pengar.php)  Kont. <?php include &quot;otentik.inc&quot;; session_start(); $sesi_user=$_SESSION[&quot;sesi_user&quot;]; $sesi_pass=$_SESSION[&quot;sesi_pass&quot;]; if (! otentikasi($sesi_user,$sesi_pass)) { header('WWW-Authenticate: Basic realm=&quot;Authentication System&quot;'); header('HTTP/1.0 401 Unauthorized'); echo &quot;You must enter a valid login ID and password to access this resource&quot;; exit(); } ?>
  • 26. Entri Pengarang (pengar.php)  Kont. <html><head><title>Kota</title></head> <body bgcolor=&quot;#F5F5F5&quot;> <table border=&quot;5&quot; align=&quot;center&quot;> <th>PENGARANG BUKU</th> <tr><td> <form method=&quot;post&quot; action=&quot; save.pengar.php &quot;> <table> <tr> <td>Kode Pengarang</td> <td> <input type=&quot;text&quot; size=&quot;4&quot; name=&quot;kdpeng&quot; maxlength=&quot;4&quot;></td> </tr> <tr> <td>Nama Pengarang</td> <td> <input type=&quot;text&quot; size=&quot;35&quot; name=&quot;nmpeng&quot;></td> </tr> <tr> <td colspan=2 align=&quot;center&quot;><input type=&quot;submit&quot; value=&quot;Rekam&quot;>&nbsp;&nbsp;&nbsp;&nbsp <input type=&quot;Reset&quot; value=&quot;Batal&quot;></td> </tr> </table></form></td></tr></table> </body></html>
  • 27. Save.pengar.php <html><body> <table border=1 align=&quot;center&quot;><tr><td align=&quot;center&quot;> <?php $kdpeng=$_POST['kdpeng']; $nmpeng=$_POST['nmpeng']; if (empty($kdpeng) or empty($nmpeng)) { print(&quot;<b><font color=red>Maaf</font></b><br>&quot;); print(&quot;Data <b>Pengarang</b> gagal diposting karena Tidak Lengkap</td>&quot;); print(&quot;<tr><td align=center><br><a href=amp;quot;pengar.phpamp;quot;>Kembali ke Entri Pengarang</a><br></td><tr></table>&quot;); exit(); } include(&quot;conect.inc.php&quot;); $query=&quot;INSERT INTO pengarang (kdpeng,nmpeng) VALUES ('$kdpeng','$nmpeng')&quot;;
  • 28. Save.pengar.php (Kont.) mysql_query ($query, $id_mysql); if ( mysql_affected_rows () >0) { print(&quot;Selamat<br>&quot;); print(&quot;Pengarang $nmpeng Telah SUKSES diCatat&quot;); } else { print(&quot;<font color=red>M a a f: Perekaman</font><br>&quot;); print(&quot;<br> Kode Pengarang = $kdpeng&quot;); print(&quot;<br> Nama Pengarang = $nmpeng<br><br>&quot;); print(&quot;Gagal dilakukan<br>&quot;); } mysql_close ($id_mysql); ?> <br><a href=&quot;pengar.php&quot;>Kembali ke Entri Pengarang</a> </td></tr></table> </body> </html>
  • 29. SAMPAI JUMPA Di FINAL TEST TERIMAKASIH