We knew all that about MySQLi is revised PHP extension of MySQL that is introduced in PHP 5.
MySQL is draw away in PHP 5.5 will be removed in future. We have also millions of applications using PHP MySQL and that should be updated on MySQLi or PDO.
Here i give you a very plain integration mentor of MySQLi how to connect to a database,how to run a query and insert records and many more.
................... Lesson of mysqli connection with the object mode .............................
<?php
$obj = new mysqli('localhost','root','password','Database_name');
?>
.................. Connection error checking with object mode .................................
<?php
$obj = new mysqli('localhost', 'root','password','Database_name');
if($obj->connect_errno > 0)
{
die('Not able to connect to database [' . $obj->connect_error . ']');
}
?>
.................. Connection error checking with procedural mode ...............................
<?php
$cn = mysqli_connect("localhost","UserName","password","Database_name") or die("Some error appear during connection " . mysqli_error($cn));
?>
............. Plain procedure with complete code with procedural mode ....................
<?php
//Create the connection
$cn = mysqli_connect("localhost","UserName","password","Database_name") or die("Some error appear during connection " . mysqli_error($cn));
// Write query
$SQ = "SELECT * FROM Table";
$query = mysqli_query($con, $SQ);
while($result = mysqli_fetch_array($query))
{
echo $result["Name"];
}
// Close the connection
mysqli_close($con);
?>
................... Plain procedure with complete code with object mode .....................
<?php
//Create the connection
$cn = new mysqli("localhost","UserName","password","Database_name") or die("Some error appear during connection");
// Write query
$SQ = "SELECT * FROM Table";
$query = $cn->query($SQ);
//we can use also
//$query->fetch_object()
//$query->fetch_array()
while($result = $query->fetch_object())
{
echo $result->Name;
}
?>

Exactly, if you learn any one of the programming language, which they have mentioned above is really helpful to get great career in IT web development industry.
ReplyDeleteRegards,
PHP Training in Chennai|PHP Course in Chennai