Jump to content

Archived

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

robcrozier

Database Queries

Recommended Posts

hi can anyone help me?

what im trying to do is output some data from a mysql table into a table on the bowser. However the tricky part is that i want each row that is outputted to have a link beside it which when clicked will delete that row from the table.

Ive got the basic table outputting at the min and just need to add the delete link.

Oh and the table is being outputted in a loop.

Help would be massively appreciate!!!!!

Share this post


Link to post
Share on other sites
if each item in your table has an id number... something similar to that below would work.

[code]
<a href="delete_entry.php?id=<?=$id?>">Delete This Entry</a>
[/code]

[code]
<?php
$id = $_GET['id'];
$query = mysql_query(DELETE * FROM your_table WHERE id_field = $id);
?>
[/code]

Might not be exactly right, but it will nudge you along the right path.

Share this post


Link to post
Share on other sites
Cheers mate that looks like what im after but lets just get this straight. The first bit of code is to go into the print statements when outputting the table and the second section foms the delete_entry.php page?

Thanx a lot mate!

Share this post


Link to post
Share on other sites
It doesnt seem like the variable $id is being passed to the delete_entry page for some reason! im trying to simply echo the variable on the new page and nothing is being displayed.

Can anyone help???

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.