Wednesday, March 30, 2016

index

<!DOCTYPE html>

<html>
    <head>
        <meta charset="UTF-8">
        <title>MySQL Example 2</title>
    </head>
    <body>
       
        <a href="insert.html">Insert customer</a>
        <br/>
        <a href="update1.php">Update customer</a>
        <br/>
        <a href="delete1.php">Delete customer</a>
       
       
        <?php
        // step 1 = connect to the server
       
        $con = mysql_connect("localhost:3306", "root", "");
       /* if($con)
        {
            echo "Connection Succesfull <br/>";
        }
        else
        {
            echo "Connection Failed <br/>";
        }
        */
        // step 2 = select the datadase
       
        mysql_select_db("dvdclub", $con);
       
        // step 3 = show the datadase
       
        $result = mysql_query("select * from customer");
       
        ?>
        <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["fname"]; ?></td>
                <td><?php echo $row["lname"]; ?></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