0

I am struggling with this, I have a database (mysql where i am trying to delete a single row. The idea is a list of items populated from the database. I am trying to add an additional column where there is a graphic and it reloads the page and runs a script that deletes the row (a session). I cannot win for some reason. It is not my original code so please don't suggest anything ridiculous.

<a href="event_manage.php?id=<? echo $id ?>&deletesession=62"> <img src="../images/icn_del.jpg"> </a>

This was a test piece of code that simply sends 62 to the deletesession function in an included file. The event_manage.php?id= is to load the same page view currently open at the same point.

    function DeleteSession($sid)
    {
        $table = " tbl_event_session ";
        return DeleteRecord($table, $sid);
    }

This is the function that should delete the session $sid that is in the table tbl_event_session.

I'm getting no-where

DELETE FROM `theDatabase`.`tbl_event_session` WHERE `tbl_event_session`.`session_id` = 62

is also not working... so I have no idea what is going wrong.
Any help would be great

3
Contributors
2
Replies
15
Views
3 Years
Discussion Span
Last Post by albucurus
0

This small piece of code appears correct. Does the script connect properly? Have you added error checking? Did you run the event_manage.php script manually?

0

Hi,
In your DeleteRecord function write this:

$sql = 'DELETE FROM $table WHERE session_id = $sid';
return mysql_query($sql);

where $table can be 'tbl_event_session'.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.