1 / 19

PHP dan MySQL

PHP dan MySQL. Konten Web. Web Statis /flat pages halaman web yang dikirimkan ke user sama persis yang ada di server. dari waktu ke waktu isi web selalu sama contoh . HTML Dinamis isi berubah sepanjang waktu database contoh . PHP, ASP, coldfusion. Static web. Dynamic Web.

calais
Download Presentation

PHP dan MySQL

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. PHP dan MySQL

  2. Konten Web • Web Statis/flat pages • halaman web yang dikirimkanke user samapersis yang adadi server. • dariwaktukewaktuisi web selalusama contoh. HTML • Dinamis • isiberubahsepanjangwaktu • database contoh. PHP, ASP, coldfusion

  3. Static web

  4. Dynamic Web

  5. PHP MySQL • Saatinibanyakaplikasi web yang berbasis php-mysql • MySQL is free • MySQL adalah DB no 2 didunia yang banyakdipakai

  6. MySQL Fact • MySQL is a database system used on the web • MySQL is a database system that runs on a server • MySQL is ideal for both small and large applications • MySQL is very fast, reliable, and easy to use • MySQL supports standard SQL • MySQL compiles on a number of platforms • MySQL is free to download and use • MySQL is developed, distributed, and supported by Oracle Corporation • MySQL is named after co-founder Monty Widenius's daughter: My

  7. Cross Platform • PHP combined with MySQL are cross-platform(Andadapatmembuataplikasidi windows tetapidi hosting di server Unix)

  8. Connect MySQL <?php $dbhost = “localhost”; $dbuser = “guest”; $dbpass = “guest123”; $conn = mysql_connect($dbhost, $dbuser, $dbpass); if(! $conn ) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; mysql_select_db( 'test_db' ); mysql_close($conn); ?>

  9. User Enterprise MySQL • Wikipedia,[12] • Google[13][14] • Facebook,[15][16][17] • Twitter,[18] • Flickr,[19] • YouTube.[20] Sumber. Wikipedia.org

  10. Table pegawai

  11. SQL • SQL is a standard language for accessing databases. Contoh. SELECT * FROM Customers; //Pilihsemua pegawai daritabel customer

  12. Some of The Most Important SQL Commands • SELECT - extracts data from a database • UPDATE - updates data in a database • DELETE - deletes data from a database • INSERT INTO - inserts new data into a database • CREATE DATABASE - creates a new database • ALTER DATABASE - modifies a database • CREATE TABLE - creates a new table • ALTER TABLE - modifies a table • DROP TABLE - deletes a table • CREATE INDEX - creates an index (search key) • DROP INDEX - deletes an index

  13. Select data SELECT column_name,column_nameFROM table_name; SELECT * FROM table_name;

  14. Menampilkannilaiunik SELECT DISTINCT column_name,column_nameFROM table_name;

  15. Syarat SELECT column_name,column_nameFROM table_nameWHERE column_name operator value; Operator = Equal <> Not equal != > Greater than < Less than >= Greater than or equal <= Less than or equal BETWEEN Betweenan inclusive range LIKE Search for a pattern IN To specify multiple possible values for a column

  16. SQL AND & OR Operators • SELECT * FROM CustomersWHERE Country='Germany'AND City='Berlin'; • SELECT * FROM CustomersWHERE City='Berlin'OR City='München'; • SELECT * FROM CustomersWHERE Country='Germany'AND (City='Berlin' OR City='München');

  17. SQL ORDER BY • SELECT column_name,column_nameFROM table_nameORDER BY column_name,column_name ASC|DESC;

  18. Connect MySQL <?php $con=mysqli_connect("example.com","peter","abc1 23","my_db"); // Check connection if (mysqli_connect_errno($con)) {echo "Failed to connect to MySQL: " . mysqli_connect_error();  }mysqli_close($con);?>

  19. PHP Select <?php$con=mysqli_connect("example.com","peter","abc123","my_db");// Check connectionif (mysqli_connect_errno())  {  echo "Failed to connect to MySQL: " . mysqli_connect_error();  }$result = mysqli_query($con,"SELECT * FROM Persons");while($row = mysqli_fetch_array($result))  {  echo $row['FirstName'] . " " . $row['LastName'];  echo "<br>";  }mysqli_close($con); ?>

More Related