thebopps Posted January 30, 2008 Share Posted January 30, 2008 I am writing a very simple piece of php software for an intranet, it stores usernames and passwords to various hardware we service for clients. I have a specific page to manage the password list, the page queries the database and returns each record in a new row of a table. I put a delete icon in the last column of each html table and need to have it delete the corresponding sql row. I just wanted to know the best way to do this. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/88521-help-with-database-record-delete/ Share on other sites More sharing options...
priti Posted January 30, 2008 Share Posted January 30, 2008 Hi, i think what you have thought is also a good option mostly it is keep like it for eas of use.just take care of some points like when you click that delete icon it should prompt message to user 'Are you sure to delete this reocrd' on yes delete the records else remain on the same page. ex: name age description Action priti 10 sdfsdf delete icon which will be a <a href='?act=delete&id=recid'> Quote Link to comment https://forums.phpfreaks.com/topic/88521-help-with-database-record-delete/#findComment-453177 Share on other sites More sharing options...
pdkv2 Posted January 30, 2008 Share Posted January 30, 2008 instead of putting a delete icon in the last column of each html table you can put one checkbox and the "delete selected" button at the bottom. this i guess is the better way. admin will be able to delete more than one record at one go. Cheers. Quote Link to comment https://forums.phpfreaks.com/topic/88521-help-with-database-record-delete/#findComment-453187 Share on other sites More sharing options...
thebopps Posted January 30, 2008 Author Share Posted January 30, 2008 thanks a lot for the feedback, i was looking more along the lines of actual code to delete that particular row Quote Link to comment https://forums.phpfreaks.com/topic/88521-help-with-database-record-delete/#findComment-453191 Share on other sites More sharing options...
timmah1 Posted January 30, 2008 Share Posted January 30, 2008 $query="delete from table_name where table_field = '".$_POST['table_field']."'"; $result = MYSQL_QUERY($query); Obviously, replace table_name and table_field with your variables Quote Link to comment https://forums.phpfreaks.com/topic/88521-help-with-database-record-delete/#findComment-453202 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.