Jump to content

Delete Record


sugnadesign

Recommended Posts

How do I Delete a Record from the DB:

Here is my code:

I would like to delete using the <li>Delete</li>

Thanks all Sugna


<?php
$sql = "SELECT requestName,requestEmail,requestPhone,requestComment,requestTypeDescr,requestDate
FROM request r
INNER JOIN mstrRequestType mrt ON r.requestTypeID = mrt.requestTypeID
ORDER BY requestTypeDescr DESC";
$result = mysql_query($sql);
while ($row = mysql_fetch_assoc($result)) {
?>
<ul>
<li>Delete</li>
<li><strong>Name:</strong> <?php echo $row['requestName']; ?></li>
<li><strong>Email:</strong> <?php echo $row['requestEmail']; ?></li>
<li><strong>Phone:</strong> <?php echo $row['requestPhone']; ?></li>
<li><strong>Comment:</strong> <?php echo $row['requestComment']; ?></li>
<li><strong>Request Type:</strong> <?php echo $row['requestTypeDescr']; ?></li>
<li><strong>Request Date:</strong> <?php echo date("m/d/Y",strtotime($row['requestDate'])); ?></li>
</ul>
<?php
}
?>
Link to comment
Share on other sites

mysql_query("delete from your_table where your_column='the_id_you_are_calling_to_delete'") or die (mysql_error());[code]
example

mysql_query("delete from request r where r.requestTypeID='mrt.requestTypeID'
") or die (mysql_error());

[/code]

everything that is in the column where r.requestTypeID = 'mrt.requestTypeID' will be deleted
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.