Jump to content


Photo

Delete Record


  • Please log in to reply
2 replies to this topic

#1 sugnadesign

sugnadesign
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 02 April 2006 - 05:03 AM

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

#2 play_

play_
  • Staff Alumni
  • Advanced Member
  • 717 posts

Posted 02 April 2006 - 05:42 AM

delete * from table where whatever=something
regex.kat.sh --- regex library
u.kat.sh ---- url shortener
tabbit.org ---- tabbed pastebin

#3 shortj75

shortj75
  • Members
  • PipPipPip
  • Advanced Member
  • 118 posts
  • LocationPort Huron,mi

Posted 02 April 2006 - 09:06 AM

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

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


everything that is in the column where r.requestTypeID = 'mrt.requestTypeID' will be deleted
The Short One

hopfully this helps if it doesn't sorry
i won't write the code for you!!! you don't learn that way




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users