Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Creating database using php.

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 115
    Comment on it

    Database in php can be Created by using the four argumnets:-
    Servername,Username,Password and dbname.

    This will give the information about the server like a using 'localhost' username as 'root' and password should be of users choice and the daname is the users database name.
     For creating the connection user use the querry  below

    <?php
    $servername = "localhost";
    $username = "root";
    $password = "";
    $dbname = "form_db";
    
    // Create connection
    $conn = new mysqli($servername, $username, $password, $dbname);
    // Check connection
    if ($conn->connect_error) {
        die("Connection failed: " . $conn->connect_error);
    }
    
    $sql = "INSERT INTO database(id, name, salary)
    VALUES ('43483', 'shristi', '10000')";
    
    if ($conn->query($sql) === TRUE) {
        echo "New record created successfully";
    } else {
        echo "Error: " . $sql . "<br>" . $conn->error;
    }
    
    $conn->close();
    ?>

     

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: