How To delete Records From PHP & (MySql)



Share

STEP 1:

php

del.html

<html>
    <head>
        <title>Delete records using php and mysql</title>
    </head>
<body>
<center>
<h2>Delete a Records</h2>
    <from action="del.php" method="post">
        enter roll number to delete:
        <input type="text" name="rn"/>
        <br><br>
        <input type="submit" value="delete"/>
    </from>
</center>
</body>
</html>

Step 2:

php

del.php

    <?php
    $rn==$_POST['rn'];
    mysqli_connect('localhost','root','');
    mysqli_select_db('temp');
    $q = "delete from student where rollnum=$rn";
    mysqli_query($q,$cnn);
    echo"Record has been deleted";
    mysqli_close($cnn);