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

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?

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'.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.