PHP-MySQL Lesson: Select Data in Database and Display the record in HTML table In this lesson we are going to write PHP scripts that select records in MySQL database and display it in HTML table. The SELECT statement in sql…
PHP-MySQL Lesson: Insert records
Insert records In this lesson we are going to write a PHP script that inserts a new record in our database through HTML forms. The INSERT INTO statement in sql is used to insert a record in the database. In…
MySQL Tutorial – Using Column Aliases
Column Aliases To rename a column in database table, use the AS keyword it allows you to alias the name to different value. The syntax of AS keyword: SELECT column_name(s)AS alias_name FROM table_name AS keyword example: SELECT f_name AS Firstname…
PHP-MySQL Lesson: Select Database
Select Database After we have establish the connection in MySQL server, we have to select a database. To do that we are going to use the mysql_select_db() function. Syntax: mysql_select_db(databasename,connection) Parameter: databasename – the database name you want to use.…
PHP-MySQL Lesson – Create Table
Creating a Table In this lesson we are going to write a PHP script that will create a table in our MySQL database. To create a table in MySQL, use the command CREATE TABLE tablename. In PHP,mysql_query() function is used to execute…
PHP-MySQL Lesson – Create Database
Creating a Database The CREATE DATABASE statement in sql is used to create a database in MySQL. In PHP,mysql_query() function is used to execute sql query like insert, delete, update, select etc. Here is an example PHP script that creates a…
PHP-MySQL Lesson – Connecting to MySQL database
Connecting to MySQL database In order to access and manage records in a database, we need first to establish a connection to the database. To connect to the MySQL database we are going to use the mysql_connect() function. Here is…
MySQL Tutorial – SQL Aggregate Functions
SQL Aggregate Functions (MIN, MAX, SUM, AVG, COUNT) MIN() – returns the minimum value of the selected field. MIN() syntax: SELECT MIN(column_name) FROM table_name; MIN() Example: SELECT MIN(salary) FROM employee_record; It will display the minimum salary.
PHP-MySQL Lesson: Introduction
PHP-MySQL Lesson: Introduction PHP and MySQL PHP is an open source scripting language used to create dynamic website. MySQL is also an open source relational database system that uses Structured Query Language (SQL). PHP supports variety of databases, but MySQL…
MySQL Tutorial – LIKE Operator
LIKE operator The LIKE operator is used to retrieve records from database table by matching pattern in SELECT SQL statement. The syntax of LIKE operator: SELECT column_name(s) FROM table_name LIKE “value”; Let’s see some example: Here is our database table:…