phprockers-logo

Delete query in mysql with php

The syntax for Delete the row into tables,

DELETE FROM
    table_name WHERE colname = row_values;    

<?php

$con = mysql_connect('localhost', 'root','');
mysql_select_db('dbname', $con) or die(mysql_error());

$query = "DELETE FROM table_name WHERE sno = 1";    
$ok = mysql_query($query);

if($ok)
echo "Deleted row successfully";
else
echo "Failed to delete the row in the table";

?>



sno name marks rank post_of_date
2 krishnan 397 3 09-04-2001
3 PHP Developer 521 36 27-03-2012

0 comments:

Post a Comment