Friday, December 27, 2013

php Database connectivity

after a long time due to some problems I am a little bit not touche with...
there is wide network of PHP websites in the world. many programmer face there is a problem in connectivity with the DataBase so i write this blog for that guys....
so enjoye it...

<?php
session_start();
class add
{
    var $conn;
   
    function __construct()
    {
        $this->conn=new MySQLi("localhost","root","","da_name");
    }
?>
-----------------------------------------------------------------------
another method
<html>
<body>
<?php
// create connection
$con=mysqli_connect("localhost","root","");
//check error
if(mysqli_connect_errno())
{
    echo "Failed to connect to MySql".mysqli_connect_error();
}
?>
</body>
</html>



No comments:

Post a Comment

GitHub repository using Git Bash command

  To add a project to a GitHub repository using Git Bash command line, you can follow these steps: Create a new repository on GitHub by logg...