robcrozier Posted March 12, 2006 Share Posted March 12, 2006 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!!!!! Quote Link to comment Share on other sites More sharing options...
wisewood Posted March 12, 2006 Share Posted March 12, 2006 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. Quote Link to comment Share on other sites More sharing options...
robcrozier Posted March 12, 2006 Author Share Posted March 12, 2006 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! Quote Link to comment Share on other sites More sharing options...
AndyB Posted March 12, 2006 Share Posted March 12, 2006 Correct. Quote Link to comment Share on other sites More sharing options...
robcrozier Posted March 13, 2006 Author Share Posted March 13, 2006 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??? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.