abc

Share This blog with your friends, so that we can improve more & more . our aim is to easy & simple way of learning.

5/23/2018

How PHP & MYSQL Related


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.

An Introduction to the Laravel Framework: What It Is and Why You Should Use It

  If you're a PHP developer looking for a modern, efficient, and powerful framework to build web applications, look no further than Lara...