Today we are
going to learn
1. about
mqsql ,
2. how is
related to php ,
3. way of define mysql,
4. connect & redirect data from mysql
database.
Mysql is
query language in which pass query & get result.
Eg: select
*from student; in this example get
student table data.
As PHP is
server side language & also use to handle mysql .
Let us see
how to connected with mysql.
$conn =
mysql_conn($host, $username, $password,
$database)
In case above example not use database then call it by
mysql_db();
NOTE : MQSQLI
is improved version & mysql is previous one version.
Eg: get
employee information from company data
<?php
$conn =
mysqli_conn(abc, kumar, welcome, company);
$q = ‘select
employee name, address , age, birthdate from employee’;
$ab =
mysqli_query($q, $conn) or die(‘error’);
While ($row =
$mysqli_fetch_row[$ab])
{
echo $row[‘name’];
echo $row[‘address’];
echo $row[‘age’];
}
?>
Above example
get all employee name , address, age. In which I use mysql_conn to connect to
database & query to pass query & get result. We will see more in next
session
Thanks for viewing blog send comment in case any query.