# Delete MySQL row using PHP

**URL:** <https://forum.kirupa.com/t/delete-mysql-row-using-php/232897>\
**Category:** Uncategorized\
**Created:** [July 18, 2007, 4:40pm UTC](https://forum.kirupa.com/t/delete-mysql-row-using-php/232897 "2007-07-18T16:40:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![vmarvaso](https://avatars.discourse-cdn.com/v4/letter/v/df788c/32.png) [@vmarvaso](https://forum.kirupa.com/u/vmarvaso)\
**Post date:** [July 18, 2007, 4:40pm UTC](https://forum.kirupa.com/t/delete-mysql-row-using-php/232897/1 "2007-07-18T16:40:42Z")

</div>

dudes, can you help me figure out how to delete a MySQL record in PHP???

i know the output should read:  
**delete.php?id=9**

i thought this would nail it but no luck:

```php

<a href="delete.php?id=<? echo "$id"; ?>">delete</a>

```

and heres the delete.php:

```php

<?
include("dbinfo.inc.php");
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query=" DELETE * FROM contacts WHERE id='$id'";
 
mysql_close();
?>
deleted!

```
