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!!!!! Link to comment https://forums.phpfreaks.com/topic/4765-database-queries/ 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. Link to comment https://forums.phpfreaks.com/topic/4765-database-queries/#findComment-16726 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! Link to comment https://forums.phpfreaks.com/topic/4765-database-queries/#findComment-16732 Share on other sites More sharing options...
AndyB Posted March 12, 2006 Share Posted March 12, 2006 Correct. Link to comment https://forums.phpfreaks.com/topic/4765-database-queries/#findComment-16737 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??? Link to comment https://forums.phpfreaks.com/topic/4765-database-queries/#findComment-17009 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.