laural Posted May 20, 2013 Share Posted May 20, 2013 I hope this question has a simple answer. I have a table of names that pulls back records that are in a table. I want to add a link by the name that says "Remove" - when clicked, I would like the name deleted from the mssql table and the page left to reflect the list without that name. Is there an easy way to accomplish this? Even if I cannot remain on the same page, how would I do that using a link? Thanks!!! Quote Link to comment Share on other sites More sharing options...
Jessica Posted May 20, 2013 Share Posted May 20, 2013 What is the problem? If you know how to read the data, you should be able to figure out how to delete the data. What part are you confused about? Quote Link to comment Share on other sites More sharing options...
laural Posted May 25, 2013 Author Share Posted May 25, 2013 Just looking for some guidance. Thanks anyway. Quote Link to comment Share on other sites More sharing options...
Jessica Posted May 26, 2013 Share Posted May 26, 2013 Guidance about what though? Quote Link to comment Share on other sites More sharing options...
Psycho Posted May 26, 2013 Share Posted May 26, 2013 (edited) Here is a vry simplistic solution: When you output the records create the delete links like so <a href="?deleteID=XXX">Delete</a> Where "XXX" is the unique id of the record to be deleted by that link. Then on the code to render the page, put something like this as the top io the script (before the output is generated). if(isset($_GET['deleteID'])) { $deleteID = intval($_GET['deleteID']; $query = "DELETE FROM table WHERE id = $deleteID"; $result = mysql_query($query); } This will refresh the page when clicking a link. If you want to not refresh the page, then you wuold use the same logic using an AJAX solution. Edited May 26, 2013 by Psycho 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.