I am creating an internal extension directory using html. How do I connect html to mysql database so as to be able to retrieve the extension number of the person I am looking for.

Recommended Answers

All 2 Replies

You cannot use HTML to connect to MySQL, the closest you can get is the PHP (Hypertext Preprocessor). I assume you're running Windows. You would need Apache server for this. I personally would recommend installing XAMPP, which has MySQL and Apache server in it. After all installation, at the end you will be asked whether open "Control Panel", makes sure that the box is checked and the panel will open, start Apache and MySQL servers. After this, go to: C:/xampp/htdocs/ create folder projects, in there, make a file called config.php, open this file with your favourite editor (let it be Notepad++, Brackets, SublimeEditor, Microsoft Notepad) and in there, copy this:

<?php
    $sql_un = "root";   // default: "root";
    $sql_pd = "";       // default: "";
    $sql_db = "";       // you will need to create database and input here it's name
    $sql_conn = mysqli_connect("127.0.0.1", $sql_un, $sql_pd, $sql_db);

    if (!$sql_conn) {
        die("Something didn't work, the file couldn't connect to database!");
    }
    echo "File's request has been successfully sent and answer received.";

?>

If you need further assistance with phpMyAdmin, or Apache server. Feel free to ask.

Thank you! Let me work on it and get back to you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.