15-01-2014, 03:53 PM
DATABASE CONNECTIVITY - PHP
DATABASE CONNECTIVITY.docx (Size: 604.56 KB / Downloads: 18)
AIM:
To write PHP script for connecting to database and perform insert, update, delete and select operations.
DESCRIPTION:
Create a Connection to a MySQL Database:
The mysql_connect() function is used to establish a connection to the database. The syntax is:
mysql_connect(servername,username,password);
where
servername Optional. Specifies the server to connect to. Default value is "localhost:3306"
username Optional. Specifies the username to log in with. Default value is the name of the user that owns the server process
password Optional. Specifies the password to log in with. Default is ""
Create a database:
A database holds one or multiple tables. The CREATE DATABASE statement is used to create a database in MySQL. The syntax is:
CREATE DATABASE database_name