PHP+MySQL : CRUD [Create Read Update Delete] part 2


PHP to MySQL connection file connect_db.php
The script below serves to access the MySQL database. Every time you want to access MySQL, you must first call connect_db.php.

Line 7 : connect to MySQL using information from variable line 2-5
Line 8 : select database


File form input booktelp_form_input.php
The contents of this script only contain html tags for form input.

Line 4: the method used is “post” and the action (data input process file to MySQL) is “bukutelp_add.php”.
Lines 8,12,16,20 : the value of name will be a variable

Command file insert data into table_telp_book booktelp_add.php
This script serves to enter data into the Buku_telp table which is inputted through the Bukutelp_form_input.php input form.

Line 2: call the connect_db.php file to login to the MySQL database
Lines 4-7 : the $_POST variable is first changed to a local variable
Line 9 : query to enter data into MySQL with values ​​taken from the value of the variable sent from the input form.
Lines 13-18: if the data input query is successful ($result is TRUE) then the message “Success saves data” appears, if it fails, the message “An error has occurred”.

good luck

Support this blog by donating via Trakteer.id, PayPal, or Jenius Pay $musaamine.

Related Posts:

  • PHP MySQL connection on OpenShift Red Hat CloudPHP MySQL connection on OpenShift Red Hat Cloud
  • [PHP]  CRUD Using PDO [Bagian 6][PHP] CRUD Using PDO [Bagian 6]
  • [PHP]  CRUD Using PDO [Bagian 5][PHP] CRUD Using PDO [Bagian 5]
  • [PHP]  CRUD Using PDO [Bagian 4][PHP] CRUD Using PDO [Bagian 4]
  • [PHP]  CRUD Using PDO [Bagian 3][PHP] CRUD Using PDO [Bagian 3]

.



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *