Step By Step Tutorial For PHP Mysql Database

Banner

28 Jan 2016

What is Mysql?

  • Open source database system
  • Like most modern Database Management Systems is based on the relational model, RDBMS.
  • Free
  • Run on Linux, Windows, Netware, AIX, and so on.
  • Easily accessible through programming languages like PHP

Why Mysql?

  • Open source database
  • consistent fast performance & high reliability
  • ease of use
  • High Availability
  • Comprehensive Application Development
  • Management Ease
  • Lowest Total Cost of Ownership

Where you can get it?

  • You can download at mysql official website, mysql.com
  • You can get mysql that packaged with php like in AppServ
  • For portable application, you can try XAMPP

Connecting to Database Use mysql_connect()

In here, we are going to talk about mysql_connect () where it is used to do the connection to MySQL database program.

Here is basic syntax:
mysql_connect(host name, user name, password)

PHP MySQL: Making Table

PHP do not provide the special function of making tables with its fields. So in order to make the data table, it stills use the syntax from database program (used MySQL) then this syntax will be operated by using of mysql_query() function.
For example, make an employee’s database of one office, personal data table with the field of employees number, employees name, and employees address.

PHP MySQL: MySQL Syntax Orders

PHP do not provide special functions for data operation, so the syntax varied is MySQL syntax orders. In order to do the data operation by using PHP, so here is the sequence as follow:

Connection to database

Declare a variable string that contains of the next MySQL syntax order
Run the MySQL syntax by using of mysql_query() function. If the syntax will produce the next output, declaration one variable to accommodate the result
Take the result of the run MySQL syntax by using the functions of mysql_fetch_array(), mysql_fetch_row(), mysql_num_rows, etc. It depends to the output wanted format

Comments are closed.