Jump to content

Archived

This topic is now archived and is closed to further replies.

sugnadesign

Delete Record

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
}
?>

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

×

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.