PHP mysql_query()函数用于删除表中数据记录。
由于PHP5.5版本起,不推荐使用mysql_query(),建议使用以下2种方法

mysqli_query()
PDO::_query()

示例

<?php
$host = 'localhost:3306';
$user = 'root';
$pass = '';
$dbname = 'mydb';

$conn = mysqli_connect($host, $user, $pass, $dbname);
if(!$conn)
{
	die('Could not connect :'.mysqli_error());
}
echo "Connected successfully<br/>";

$id = 2;
$sql = "delete from `emp5` where `id` ='".$id."'";
if(mysqli_query($conn,$sql))
{
	echo "Record deleted successfully";
}else{
	echo "Could not delete record:".$mysqli_error($conn);
}

mysqli_close($conn);
?>

执行上述代码,结果如下

Connect successfully
Record deleted successfully