Jump to content

thehitechpanky

New Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by thehitechpanky

  1. Hi Little Help Needed
    I have created a new website
    In the index.php file i want to show records from database

    Now, here is how the problem arise
    I want to import codes from github intead of hosting those files on my server because i want to keep it opensource

    Below is the code I am using
    <?php
    // connect to the database
    include('connect-db.php');

    // get results from database
    $sql = "SELECT id, upadhi, name FROM munishri";
    $result = $conn->query($sql);

    if ($result->num_rows > 0) {
    // output data of each row
    while($row = $result->fetch_assoc()) {
    echo "id: " . $row["id"]. " - Name: " . $row["upadhi"]. " " . $row["name"]. "<br>";
    }
    } else {
    echo "0 results";
    }

    // close connection
    $conn->close();
    ?>

    Can i host the code to show result in another file and use something like
    <?php
    // connect to the database
    include('connect-db.php');

    // get results from database
    include('http://rawgit.com/thehitechpanky/jainmunilocator/master/database.php');
    ?>

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.