2. Database Creation and PHP MySQLi Connection Script Tutorial


Lesson Code: http://www.developphp.com/video/PHP/Database-Creation-and-PHP-MySQLi-Connection-Script-Tutorial
Learn to create the Database on your host and write a modular PHP script for establishing connection to that database using the improved MySQLi extension. PHP and MySQL are the core data processing technologies of most popular social networking websites.

50 thoughts on “2. Database Creation and PHP MySQLi Connection Script Tutorial

  1. when I upload page, then go to the address: This page isn't working http error 500, so it ends for me at this point. It worked in 2012 when I first tried it but now, I cant get past this point.

  2. You're the best pedagogue I,ve ever met in my life. You are nothing but a great fellow.
    You made everything easy & helpful to reach in advance level. Thank you bro 🙂

  3. <?php
    $servername = "localhost";
    $username = "root";
    $password = " ";

    // Create connection
    $conn = new mysqli($servername, $username, $password);

    // Check connection
    if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
    echo "Connected successfully";

  4. Hey adam! I tried the same code on my godaddy account it keeps showing me the same error:
    Internal Server Error
    The server encountered an internal error or misconfiguration and was unable to complete your request.
    Please contact the server administrator to inform of the time the error occurred and of anything you might have done that may have caused the error.More information about this error may be available in the server error log. 
    I have got my credentials right and there is no .htaccess file in my file manager. can u help?

  5. Hi, Adam Koury or anyone I have watched this video 5 times and I am still getting this same error:
    Warning: mysqli_connect(): (28000/1045): Access denied for user 'u476219331_rohit'@'localhost'(using password: YES) in /home/u476219331/public_html/php_includes/db_conx.php on line 2
    Access denied for user 'u476219331_rohit'@'localhost'(using password: YES)
    what should I do and here is my code and I have not put my password for security reasons but when I put it live I had  put my password:
    $db_conx = mysqli_connect("localhost", "u476219331_rohit", "xxxxxxxxx", "u476219331_ulink");
    // Evaluate the connection
    if (mysqli_connect_errno()){
        echo mysqli_connect_error();
    } else {
        echo "successful database connectio, yea this works!!!";
    Please someone help me here.

  6. why were you able to navigate straight to the db_conx.php file with simply your domain address and the file name? when the actual path would be your domain, then the public html/then root/ then php_includes/ then db_conx.php?  thanks

  7. Adam that guy shawn sux all his videos are half ass, we need you buddy ive been watching your videos for years and never had a problem not one, i dont think he is good enough to be on 2.0  

  8. I am a very seasoned professional and I really enjoy your style.  I like the OOPY reference from Seinfeld.  I sent a link to this to a PHP coder friend from the Bronx.  Also he needs to learn a liittle OOPY, Shmoopy!

  9. If you have a GoDaddy account you can find your "mysgli_connect" info by doing the following.

    1: Go to the "Hosting Details" age.
    2:Locate and click on MYSQL.
    3:Add a database if you haven't already.
    4:After you created one you should be able to see the new one you created. There will be two buttons.{"Actions" and "phpMYADMIN"} Click on Actions.
    5:Find and Click on "Details"
    6:After you click details, a box will appear with your Database Details. You will see Four buttons labled in order as follows;[Backup]  [Restore]  [Delete]  [Code Sample] 
    7:Click Code Sample
    8:Look through and you will see your,{$hostname $username, $dbname}

    Hope this helped. I had to look for mine and was thankful to find it. I have been on the telephone with godaddy on many occasions and am not a big fan of the help they provide.

    Oh Yeah Ty for the video you helped me a bunch.

  10. hi has anyone been getting errors when puting it on the live server. It worked on MAMP, but I get this when I try to run it on my live site:

    Fatal error: Call to undefined function myqli_connection_error()

    if anyone has any idea on this I'd appreciate the help.

  11. hi Adam Khoury.
    nice Tutorials.
    im very new to all this stuff, and i have a problem with getting connected to my sql. i cant make a new user to my database, or then i already did it but cant find it. could you help me ?

  12. I liked that Over OPPing. That thing happened to me. It was a good approach but after things got complex i lost myself over classes objects and files. Sometimes its handy but sometimes can lead in disaster, because PHP its not that good at object oriented !

Leave a Reply

Your email address will not be published. Required fields are marked *