sql database

sql database

szafarszafar Posts: 12Questions: 2Answers: 0
edited April 2014 in General
how can i load data from sql database for a field

Replies

  • Rawland_HustleRawland_Hustle Posts: 94Questions: 16Answers: 0
    I'm a total noob and I don't know if this is right for you. This is how I did it though.

    I use the code below which I found. Replace "hidden" and "country", "city" and "population" with your information.

    [code]
    <?php
    $dbhost = 'hidden';
    $dbuser = 'hidden';
    $dbpass = 'hidden';
    $dbname = 'hidden';

    // Create connection
    $con=mysqli_connect($dbhost,$dbuser,$dbpass,$dbname);

    $result = mysqli_query($con,"SELECT * FROM world");

    echo "


    Column1
    Column2
    Column3

    ";

    while($row = mysqli_fetch_array($result))
    {
    echo "";
    echo "" . $row['country'] . "";
    echo "" . $row['city'] . "";
    echo "" . $row['population'] . "";
    echo "";
    }
    echo "";

    mysqli_close($con);
    ?>
    [/code]
This discussion has been closed.