If we want to access or store information from or to the database and display in our website, we can use Mysql as our database. Actually PHP is compatible with several DBMS such as Mysql, Postgre, Oracle, and many more. But in this section, we will discuss more about Mysql because Mysql is an open source (free) database and easy to use because for querying, we also use SQL syntax.
Mysql is a popular database in developing website world because Mysql has several powerful plus point that make it become more popular than other such as:
1. Quick: since mysql was created, it was already designed to have quick access time in displaying data.
2. Not expensive: Mysql can be download freely.
3. Essy to use:we can interate with Mysql by using simple SQL syntax.
4. Run on any kinds of platform: Mysql can operate in whatever kinds of operating system such as Windows, Unix, Mac OS, etc.
5. Has several help tool: in internet, you can join with many kinds of mailing list about Mysql.
Nowadays Mysql has 3 versions such as 4.0 , 4.1 and 5.0. 5.0 version is still in developing stage, so it is not recommended to be used for making a big scale website.
The following are the simple syntax for running the PHP and Mysql:
1. mysql_connect is used to make or open a connection between PHP and Mysql.
2. mysql_query is used to run query in Mysql.
3. mysql_num_rows is used to know how many rows are affected with the SQL syntax.
4. mysql_fetch_array is used to fetch the data from the database, you can define what fields that you want to fetch its data.
5. mysql_fetch_row is used to fetch data per row from the database.
6. mysql_close is used to close a connection.
Queries is a question or request.
With MySQL, we can query a database for specific information and have a recordset returned.
For example:
Look at this below table:
Name Address Telp Country
Jane Golden Street no 7 1234564 England
Diana Bueno Vista 98745356 Singapore
If we use the queries like "SELECT * FROM t_customer WHERE country='Singapore'"
Then the result will be shown Diana Bueno Vista 98745356 Singapore
Mysql is a popular database in developing website world because Mysql has several powerful plus point that make it become more popular than other such as:
1. Quick: since mysql was created, it was already designed to have quick access time in displaying data.
2. Not expensive: Mysql can be download freely.
3. Essy to use:we can interate with Mysql by using simple SQL syntax.
4. Run on any kinds of platform: Mysql can operate in whatever kinds of operating system such as Windows, Unix, Mac OS, etc.
5. Has several help tool: in internet, you can join with many kinds of mailing list about Mysql.
Nowadays Mysql has 3 versions such as 4.0 , 4.1 and 5.0. 5.0 version is still in developing stage, so it is not recommended to be used for making a big scale website.
The following are the simple syntax for running the PHP and Mysql:
1. mysql_connect is used to make or open a connection between PHP and Mysql.
2. mysql_query is used to run query in Mysql.
3. mysql_num_rows is used to know how many rows are affected with the SQL syntax.
4. mysql_fetch_array is used to fetch the data from the database, you can define what fields that you want to fetch its data.
5. mysql_fetch_row is used to fetch data per row from the database.
6. mysql_close is used to close a connection.
Queries
Queries is a question or request.
With MySQL, we can query a database for specific information and have a recordset returned.
For example:
Look at this below table:
If we use the queries like "SELECT * FROM t_customer WHERE country='Singapore'"
Then the result will be shown Diana Bueno Vista 98745356 Singapore
No comments:
Post a Comment