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.…
Tag: Database Programming
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…
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…
PHP if…else…if statement
PHP if…else…if statement if…elseif….else statement – use this statement to select one of several blocks of code to be executed. The if…elseif….else statement This statement is used to select one of several blocks of code to be executed. The if..else…