All-Starr 24-7
06-19-2004, 02:57 PM
Hey all,
I know how to delete a row from a MySQL database, but i want it to be clickable.I have a shoutbox script(made in php) and in the admin i want the admin user to be able to delete any post simple bly clicking the title.Can anyone help?Any help what so ever is gretaly appreciated.
Thank you,
All-Starr 24-7
laserlight
06-19-2004, 03:00 PM
A possible solution is to pass 2 name/value pairs:
1 to specify the action of row deletion
1 to specify the row, e.g. the primary key
After authenticating the admin, you can then use the $_GET array to help determine the appropriate action and target row.
All-Starr 24-7
06-19-2004, 03:04 PM
Lol..I forgot to mention i am new at php, and do not understand complicated codes..lol.If you post as simple as possible, or explian, it will make it ,much easier for me. Sorry to be so "stupid" lol.:(
Thanks again,
All-Starr 24-7
laserlight
06-20-2004, 12:47 AM
For example, you might have the page "shoutbox.php"
Then there could be a hyperlink:
shoutbox.php?action=delete&row=10
So your script would first ensure that the user has the relevant admin powers, then since $_GET['action'] is "delete", it would attempt to delete the row with primary key of 10, from $_GET['row']
All-Starr 24-7
06-21-2004, 08:31 AM
Thanks i get it now.I have it up and working.:cool:
SeņorAmor
06-21-2004, 11:35 AM
Just make sure you only allow the link to be clickable (and again the function that runs the delete command) available only to users designated as admins (or whatever).