deleting entry from table
Posted 19 October 2006 - 09:15 PM
messages is sent thru sendpm.php
and read thru readpm.php
everything works fine but i need to make an option to delete the message.
How can i create a "delete" link in front of each message so that when it is pressed the message gets deleted.??
This are the fields in "messages" table:-
Posted 19 October 2006 - 09:22 PM
on the delete_pm page use $_GET to get the message id eg:
$message_id = $_GET['id']
Then you need to have some kind of security to ensure that the person deleting the message is authorised to do so. Perhaps compare the users id to the message_to? (Im assuming certain things about your database structure here, if you dont get what I mean then just ask me to elaborate)
mysql_query("DELETE FROM messages WHERE message_id = '$message_id'")or die(mysql_error());
Is that what you were after?
Posted 19 October 2006 - 09:41 PM
Posted 19 October 2006 - 09:45 PM
Posted 20 October 2006 - 02:00 AM
make sure before you use that, put
LIMIT 1at the end of the query. otherwise all of the entries in that table will be dropped.
Posted 20 October 2006 - 02:16 AM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users