SitePoint Sponsor

User Tag List

Results 1 to 25 of 122

Threaded View

  1. #1
    SitePoint Evangelist nick0161's Avatar
    Join Date
    Oct 2004
    Location
    australia
    Posts
    424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up deleting records with checkboxes

    hi, i have been able to connect to a mysql db and show the contents of the db in a table format and included a boolean field (checkbox) on the end of each row of information.


    RoomID Date Time_Start Time_Finish Persons_Inc Guests Delete?
    BoardRoom 2004-10-20 05:00:00 16:00:00 amir me (tickbox)
    BoardRoom 2004-10-20 06:00:00 09:00:00 amir mark me

    now what i have also done is included a delete button. my aim is to tick a box of a record i want deleted, and then click the "delete" button and delete the record....

    the trouble i have is actually deleting the specified record... i can delete the whole db... (done many times) but can't select one row.. i'm following a tutorial which is similar and using that as a reference... however i am having trouble using an array approach as seen bellow..

    if (isset($_POST['action2']) == 'submitted2'){
    echo "deleted record";
    $array = explode(",",$delete);

    $sql = "DELETE FROM timetable WHERE RoomID ='$array[0]' AND Date='$array[1]' AND Time_Start='$array[2]'";

    $result = mysql_query($sql, $db) or die ("Invalid query");

    the $sql line is causing the problem, and an undefined index error arises...

    any help with this would be greatly appreciated... (the primary keys are RoomID, Date, Time_Start)... that's why i included them in $sql sentence..

    thanks --- nick -----
    Last edited by nick0161; Oct 11, 2004 at 21:55.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •