Wednesday, March 30, 2016

index 2

<!DOCTYPE html>

<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        
        <a href="showinfo.php">Show Information</a>
        <br/>
        
        <?php
        
        //step 1 = connect to the server
        $con = mysql_connect("localhost:3306" ,"root", "");
        
        //step 2 = select the datebase
        mysql_select_db("dvdclub", $con);
        
        //step 3 = execute the query
        $result = mysql_query("select * from customers");
        
        ?>
        
        <table border="1">
            <tr>
                <th>ID</th>
                <th>First Name</th>
                <th>Last Name</th>
            </tr>
            <?php
            while ($row = mysql_fetch_array($result))
            {
                ?>
            <tr>
                <td><?php echo $row["id"]?></td>
                <td><?php echo $row["FirstName"]?></td>
                <td><?php echo $row["LastName"]?></td>

            </tr>
            <?php
            }
            ?>
        </table>
        
        <?php
        //step 4 = close the connection
        mysql_close($con);
        ?>
    </body>
</html>

No comments

Post a Comment

follow me

All Rights Reserved by personal © 2015 - 2016
Powered By Blogger, Designed by Mohammed ARG