Delete a record from mysql database using php

This post is about how to delete a record from mysql database using php.

The php code :

<?php
$connection=mysql_connect("localhost","root","")
   or die("Couldn't connect to the server");
$db=mysql_select_db("produce",$connection)
   or die ("Couldn't select database");
$result=mysql_query("DELETE FROM fruit WHERE name='CD'");
$result=mysql_query("SELECT * FROM fruit"); 
echo "<table border='1'>";
echo "<tr>";
echo "<th>Name</th><th>Number</th><th>Quantity</th>";
echo "</tr>";
while($row=mysql_fetch_array($result))
{
     echo "<tr>";
     echo "<td>",$row['name'],"</td><td>",$row['number'],"

            </td><td>",$row['quantity'],"</td>";
    echo "</tr>";
}
echo "</table>";
mysql_close($connection);
?>  


Before running the program :
NameNumberQuantity
DVD110
PENDRIVE250
CD325
KEYBOARD415

After running the program :
NameNumberQuantity
DVD110
PENDRIVE250
KEYBOARD415
                                     

Top