SitePoint Sponsor

User Tag List

Page 1 of 5 12345 LastLast
Results 1 to 25 of 122
  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 22:55.

  2. #2
    SitePoint Wizard cranial-bore's Avatar
    Join Date
    Jan 2002
    Location
    Australia
    Posts
    2,634
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,
    I'm a little unclear about your database structure but what I would recommend, if you don't already, is to have a unique key for the table. Make it so every row in the DB table is uniquely identifiable by a number.

    You would then use that number, and that number alone to delete the rows. It'd require a simplier query than your current one.

    **EDIT**
    Sorry for some reason I missed the end of your post about your primary keys. I would still recommend a single numeric primary key. It makes identifying row a lot simplier for the checkbox method, as each value in the returned array contains all the information needed to remove a row.

    So on the page that lists your records with the checkbox to delete each, you would give every checkbox the same name (in HTML) with square brackets. You'd also put the value for every checkbox to be the unique ID it has in the number base.
    eg. you could run a select query and for each row returned by the query echo a checkbox with name="record[]" and value="$ID" (where $ID is the unique ID from the DB).

    Then when the user hits the submit button the $record variable will be an array which will contain each unique ID that has been selected for deletion.
    The non-selected checkboxes will not be in the array, it will contain only the IDs that were selected.
    You'd then cycle through the array and run a delete query for every value in the array.

    Here is sample code to generate your list of records to delete.
    It uses field names called 'ID' and 'name' and makes a simple row with the name and checkbox for each.
    PHP Code:
        $result=mysql_query("SELECT ID, name FROM table");
        while(
    $r=mysql_fetch_array($result))
        {
          
    $ID $r["ID"];
          
    $name $r["name"];
        
        echo 
    "$name <input type='checkbox' name='record[]' value='$ID'/><br/>";
        } 
    Then when your user hits submit on the form that contains the output data from above you do something like this....
    PHP Code:
        if(isset($_POST['submit']))
        {
         
    $record$_POST['record'];
        
         for(
    $i=0$i<count($record); $i++)
        {
        
    $remove $record[$i];
         
    mysql_query("DELETE FROM table WHERE ID='$remove'");
        }
        } 
    This would get the $record variable from $_POST, which is an array of all the IDs to be deleted. It would then run a loop through the array, copying the value in each position of the array to the variable $remove and run an sql query to delete that row of the database.

    I hope that makes sense to you.
    Last edited by cranial-bore; Oct 10, 2004 at 23:08. Reason: incomplete information

  3. #3
    SitePoint Evangelist nick0161's Avatar
    Join Date
    Oct 2004
    Location
    australia
    Posts
    424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nice, i'll give it a shot..
    thanks mate...

    cheers for your time n effort....

    i never thought of just using a unique no. instead of the 3 primary keys.. i agree it will make the queries a lot easier... thanks...

  4. #4
    SitePoint Evangelist nick0161's Avatar
    Join Date
    Oct 2004
    Location
    australia
    Posts
    424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmmm justing thinking about it more... this script is for bookings of two rooms, and using this unique number they'll will have to know what numbers they can use... is they're an autonumber function similiar to that of access....

    thanks
    nick

  5. #5
    SitePoint Evangelist nick0161's Avatar
    Join Date
    Oct 2004
    Location
    australia
    Posts
    424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmm.. basically ended up with the same problem as before, ie undefined index.. of record from
    $record= $_POST['record'];
    i have defined $record, and ['record'].... hmmm *scratching my head*
    thanks anyway...
    any suggestions? i have a feeling the problem is with

    echo "<input type='checkbox' name='record[]' value='$IDNO'/><td/></tr>";

  6. #6
    SitePoint Wizard cranial-bore's Avatar
    Join Date
    Jan 2002
    Location
    Australia
    Posts
    2,634
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can set a primary key with a numeric data type to be auto increment, so that every new record will automatically be assigned a value of 1 higher than the existing highest number. If you are using PhpMyAdmin to create or modify your tables you can set the 'extra' drop down box to be auto_increment.

    It's hard for my to say what causes your error as I'm not familiar with your project.
    What I would suggest though is making a dummy table, nice and simple with just two fields, ID and value . Then build a protoype of your checkbox deleting system to remove records from that table. I often find making little prototypes like that can make tasks easier when you want to apply them to real databases.

  7. #7
    SitePoint Evangelist nick0161's Avatar
    Join Date
    Oct 2004
    Location
    australia
    Posts
    424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    no worries, thanks for that... yeh the only thing i didn't like about the unique number was the fact that the customers had to know what number to put in, this auto_increment is what i needed, however it was nice to have my three different fields as primary keys as it reduced data redundancy, and eliminated error of bookings. ie 2 bookings couldn't be made to the same room, same date, same time, however this unique number will disable this... hmmm... i think i will take your suggestion of completing a protoype too, i agree they do help ....

    thx for your reply...

    - has anyone encountered an undefined index problem
    - also my problem say an error ocurred on a line number which is totally irrevelant to the statement

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

  8. #8
    SitePoint Evangelist nick0161's Avatar
    Join Date
    Oct 2004
    Location
    australia
    Posts
    424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yeh i can... but before i do... how do you guys post the script in the lil boxes... i can just copy paste, but it's harder to read

  9. #9
    SitePoint Evangelist nick0161's Avatar
    Join Date
    Oct 2004
    Location
    australia
    Posts
    424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    NOTE - I KNOW IT ISN'T COMMENTED AND PROBABLY POORLY CODED IN PARTS

    -------------------------------------------

    <table>
    <tr>
    <td>

    <?php
    global $delete;
    global $submit;
    global $eventid;
    global $del;
    global $record;

    if (isset($_POST['action'])){
    $enventid = "2004-10-20";}
    else{
    //$enventid = $_GET['eventid'];
    $enventid = "2004-10-20";
    }

    echo "<html><body bgcolor=#FFFFFF>";
    //echo "<form method=\"POST\" action=\"testresults.php\">";
    $db = mysql_connect("localhost","root");//,"password");
    //mysql_select_db("database",$db);
    mysql_select_db("t1",$db);

    $sql = "SELECT * from timetable where Date";
    $result = mysql_query($sql, $db) or die ("Invalid query");

    ?>
    <br><hr noshade>
    <table cellpadding=0 cellspacing=0 width=200>
    <tr><td>
    <table border=1>
    <tr><td>RoomID</td>
    <td>Date</td>
    <td>Time_Start</td>
    <td>Time_Finish</td>
    <td>Persons_Inc</td>
    <td>Guests</td>
    <td>Delete?</td>
    </tr>
    <?php


    while ($row = mysql_fetch_array($result)){
    if ( "$row[Date]" == "$enventid"){
    echo "<tr><td>$row[RoomID]</td><td>";
    echo "$row[Date]</td><td>";
    echo "$row[Time_Start]</td><td>";
    echo "$row[Time_Finish]</td><td>";
    echo "$row[Persons_inc]</td><td>";
    echo "$row[Guests]</td><td>";
    echo "<input type=\"radio\" value=\"$row[RoomID],$row[Date],$row[Time_Start]\" name=\"delete\"></td></tr>";

    }
    }

    //--------------------------------------

    ?> </table></td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td>

    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
    RoomID: <br />

    <select name="book[roomid]">
    <option value="1">BoardRoom
    <option value="2">SmallRoom
    </select><br>


    Date: yyyy/mm/dd <input type="text" name="book[date]" /><br />
    Start Time : <input type="text" name="book[start_time]" /><br />
    Finish Time: <input type="text" name="book[finish_time]" /><br />
    Persons Included: <input type="text" name="book[persons_inc]" /><br />
    Guests: <input type="text" name="book[guests]" /><br />


    <br />
    <form method = "POST" action="delrecord.php">
    <input type="hidden" name="action" value="submitted" />
    <input type="submit" name="submit" value="Submit Booking" />
    </form>


    <form method = "POST" action="delrecord.php">
    <input type="hidden" name="action2" value="submitted2" />
    <input type="submit" name="submit2" value="Delete" />
    </form>



    <?php
    if (isset($_POST['action']) == 'submitted'){

    $RmID = $_POST['book']['roomid'];
    if ($RmID == '2'){
    $RoomID = "SmallRoom";}
    else { $RoomID = "BoardRoom";}
    $Date = $_POST['book']['date'];
    $Time_Start = $_POST['book']['start_time'];
    $Time_Finish = $_POST['book']['finish_time'];
    $Persons_inc = $_POST['book']['persons_inc'];
    $Guests = $_POST['book']['guests'];

    $sql = "INSERT INTO timetable (RoomID,Date,Time_Start,Time_Finish,Persons_inc,Guests) VALUES('$RoomID','$Date','$Time_Start','$Time_Finish','$Persons_inc','$Guests')";
    $result = mysql_query($sql, $db) or die ("Invalid query");
    echo "<b>Submission Added</b><br><br>";
    }


    if (isset($_POST['action2']) == 'submitted'){
    echo "you would like to delete";
    $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");

    }
    ?>
    </tr></table>

    ---------------------

    there it is

  10. #10
    SitePoint Evangelist nick0161's Avatar
    Join Date
    Oct 2004
    Location
    australia
    Posts
    424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i changed the statement and still had the same error- it goes for index 1 & 2

    Notice: Undefined index: 1 in c:\program files\apache group\apache\htdocs\delrecord.php on line 66

    the version i gave you is saved under a different name because i copied pasted across to another file first and deleted some working progress stuff that wasn't work and made it look messy....

    with the $sql = "SELECT * from timetable where Date"; statement, used to be
    $sql = "SELECT * from timetable where Date='$eventid'"; but that never worked...
    i must of left it there...

  11. #11
    SitePoint Evangelist nick0161's Avatar
    Join Date
    Oct 2004
    Location
    australia
    Posts
    424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <option value="2">SmallRoom

    -- it hasn't anything to do with delete statement though

  12. #12
    SitePoint Evangelist nick0161's Avatar
    Join Date
    Oct 2004
    Location
    australia
    Posts
    424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i had to pass $eventid, to $enventid, otherwise when i refreshed it it didn't like it, because $eventid comes from another page, where there is a calendar, and you click on a date, the date you click on goes into $eventid, then i passed
    $enventid = $_GET['eventid'];
    currently this is commented out so i don't have to go to the other page for testing....

    because that
    $sql = "SELECT * from timetable where Date='$eventid'";
    statement i couldn't get to work for some reason

    so that's why there is an if statement under the first while loop... i know its a bit weird sorry mate, by the i am appreciating your help too...

  13. #13
    SitePoint Evangelist nick0161's Avatar
    Join Date
    Oct 2004
    Location
    australia
    Posts
    424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i got parse error.
    actually just noticed double ", oops this php editor i use inserts two " when you type one... stupid thing, now it works but delete still doesn't

    also i just commented out the if statement under the first while loop...

    if ( "$row[Date]" == "$enventid"){ as i didn't need it because

    $sql = "SELECT * from timetable where Date='$enventid'";
    worked


    <option value="2">SmallRoom
    same error as before on the above line... does the lines below seem alright to you... it seems the Date='$array[1]' AND Time_Start='$array[2]'"; is the problem with there indexes... hmmm

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

  14. #14
    SitePoint Evangelist nick0161's Avatar
    Join Date
    Oct 2004
    Location
    australia
    Posts
    424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if i change $sql = "DELETE FROM timetable WHERE RoomID='$array[0]' AND Date='$array[1]' AND Time_Start='$array[2]'";

    to $sql = "DELETE FROM timetable";

    then the whole database is wiped out.. which would be expected...
    so that bit does work... just need to work out the bit after WHERE... hmmm

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

    <table>
    <tr>
    <td>

    <?php
    global $delete;
    global $submit;
    global $eventid;
    global $del;
    global $record;

    if (isset($_POST['action'])){
    $enventid = "2004-10-20";}
    else{
    //$enventid = $_GET['eventid'];
    $enventid = "2004-10-20";
    }

    echo "<html><body bgcolor=#FFFFFF>";
    //echo "<form method=\"POST\" action=\"testresults.php\">";
    $db = mysql_connect("localhost","root");//,"password");
    //mysql_select_db("database",$db);
    mysql_select_db("t1",$db);

    $sql = "SELECT * from timetable where Date='$enventid'";
    $result = mysql_query($sql, $db) or die ("Invalid query");

    ?>
    <br><hr noshade>
    <table cellpadding=0 cellspacing=0 width=200>
    <tr><td>
    <table border=1>
    <tr><td>RoomID</td>
    <td>Date</td>
    <td>Time_Start</td>
    <td>Time_Finish</td>
    <td>Persons_Inc</td>
    <td>Guests</td>
    <td>Delete?</td>
    </tr>
    <?php


    while ($row = mysql_fetch_array($result)){
    echo "<tr><td>$row[RoomID]</td><td>";
    echo "$row[Date]</td><td>";
    echo "$row[Time_Start]</td><td>";
    echo "$row[Time_Finish]</td><td>";
    echo "$row[Persons_inc]</td><td>";
    echo "$row[Guests]</td><td>";
    echo "<input type=\"radio\" value=\"$row[RoomID],$row[Date],$row[Time_Start]\" name=\"delete\"></td></tr>";
    }

    //--------------------------------------

    ?> </table></td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td>

    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
    RoomID: <br />

    <select name="book[roomid]">
    <option value="1">BoardRoom
    <option value="2">SmallRoom
    </select><br>


    Date: yyyy/mm/dd <input type="text" name="book[date]" /><br />
    Start Time : <input type="text" name="book[start_time]" /><br />
    Finish Time: <input type="text" name="book[finish_time]" /><br />
    Persons Included: <input type="text" name="book[persons_inc]" /><br />
    Guests: <input type="text" name="book[guests]" /><br />


    <br />
    <form method = "POST" action="delrecord.php">
    <input type="hidden" name="action" value="submitted" />
    <input type="submit" name="submit" value="Submit Booking" />
    </form>


    <form method = "POST" action="delrecord.php">
    <input type="hidden" name="action2" value="submitted2" />
    <input type="submit" name="submit2" value="Delete" />
    </form>



    <?php
    if (isset($_POST['action']) == 'submitted'){

    $RmID = $_POST['book']['roomid'];
    if ($RmID == '2'){
    $RoomID = "SmallRoom";}
    else { $RoomID = "BoardRoom";}
    $Date = $_POST['book']['date'];
    $Time_Start = $_POST['book']['start_time'];
    $Time_Finish = $_POST['book']['finish_time'];
    $Persons_inc = $_POST['book']['persons_inc'];
    $Guests = $_POST['book']['guests'];

    $sql = "INSERT INTO timetable (RoomID,Date,Time_Start,Time_Finish,Persons_inc,Guests) VALUES('$RoomID','$Date','$Time_Start','$Time_Finish','$Persons_inc','$Guests')";
    $result = mysql_query($sql, $db) or die ("Invalid query");
    echo "<b>Submission Added</b><br><br>";
    }


    if (isset($_POST['action2']) == 'submitted'){
    echo "you would like to delete";
    $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");

    }
    ?>
    </tr></table>

    ------------------------------

  16. #16
    SitePoint Evangelist nick0161's Avatar
    Join Date
    Oct 2004
    Location
    australia
    Posts
    424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    array is meant to come from

    echo "<input type=\"radio\" value=\"$row[RoomID],$row[Date],$row[Time_Start]\" name=\"delete\"></td></tr>";
    }

  17. #17
    SitePoint Evangelist nick0161's Avatar
    Join Date
    Oct 2004
    Location
    australia
    Posts
    424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    tried that didn't work... same error...

    hmmmmmm

  18. #18
    SitePoint Evangelist nick0161's Avatar
    Join Date
    Oct 2004
    Location
    australia
    Posts
    424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    crap...
    i just tried $sql = "DELETE FROM timetable";
    to clear the database... and it came up with the same error...
    so must be something else wrong to because that used to work...

  19. #19
    SitePoint Zealot devscripts's Avatar
    Join Date
    Sep 2004
    Location
    ur monitor
    Posts
    175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if u have any more problems... please paste ur full code here coz now i dunno where u r and we on second page of this forum, it takes alot of time to go back to all posts lol.

    paste code plus error. AFTER u hit save and tested it.

    thanx.
    "None of you [truly] believes until he wishes for his brother what he wishes for himself." By The one and Only Prophet Mohammed (Peace and blessings be upon him)

  20. #20
    SitePoint Evangelist nick0161's Avatar
    Join Date
    Oct 2004
    Location
    australia
    Posts
    424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <table>
    <tr>
    <td>

    <?php
    global $delete;
    global $submit;
    global $eventid;
    global $del;
    global $record;

    if (isset($_POST['action'])){
    $enventid = "2004-10-20";}
    else{
    //$enventid = $_GET['eventid'];
    $enventid = "2004-10-20";
    }

    echo "<html><body bgcolor=#FFFFFF>";
    //echo "<form method=\"POST\" action=\"testresults.php\">";
    $db = mysql_connect("localhost","root");//,"password");
    //mysql_select_db("database",$db);
    mysql_select_db("t1",$db);

    $sql = "SELECT * from timetable where Date='$enventid'";
    $result = mysql_query($sql, $db) or die ("Invalid query");

    ?>
    <br><hr noshade>
    <table cellpadding=0 cellspacing=0 width=200>
    <tr><td>
    <table border=1>
    <tr><td>RoomID</td>
    <td>Date</td>
    <td>Time_Start</td>
    <td>Time_Finish</td>
    <td>Persons_Inc</td>
    <td>Guests</td>
    <td>Delete?</td>
    </tr>
    <?php
    while ($row = mysql_fetch_array($result)){
    echo "<tr><td>$row[RoomID]</td><td>";
    echo "$row[Date]</td><td>";
    echo "$row[Time_Start]</td><td>";
    echo "$row[Time_Finish]</td><td>";
    echo "$row[Persons_inc]</td><td>";
    echo "$row[Guests]</td><td>";
    echo "<input type=\"radio\" value=\"$row[RoomID],$row[Date],$row[Time_Start]\" name=\"delete\"></td></tr>";


    }

    //--------------------------------------

    ?> </table></td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td>

    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
    RoomID: <br />

    <select name="book[roomid]">
    <option value="1">BoardRoom
    <option value="2">SmallRoom
    </select><br>


    Date: yyyy/mm/dd <input type="text" name="book[date]" /><br />
    Start Time : <input type="text" name="book[start_time]" /><br />
    Finish Time: <input type="text" name="book[finish_time]" /><br />
    Persons Included: <input type="text" name="book[persons_inc]" /><br />
    Guests: <input type="text" name="book[guests]" /><br />


    <br />
    <form method = "POST" action="delrecord.php">
    <input type="hidden" name="action" value="submitted" />
    <input type="submit" name="submit" value="Submit Booking" />
    </form>


    <form method = "POST" action="delrecord.php">
    <input type="hidden" name="action2" value="submitted2" />
    <input type="submit" name="submit2" value="Delete" />
    </form>



    <?php
    if (isset($_POST['action']) == 'submitted'){

    $RmID = $_POST['book']['roomid'];
    if ($RmID == '2'){
    $RoomID = "SmallRoom";}
    else { $RoomID = "BoardRoom";}
    $Date = $_POST['book']['date'];
    $Time_Start = $_POST['book']['start_time'];
    $Time_Finish = $_POST['book']['finish_time'];
    $Persons_inc = $_POST['book']['persons_inc'];
    $Guests = $_POST['book']['guests'];

    $sql = "INSERT INTO timetable (RoomID,Date,Time_Start,Time_Finish,Persons_inc,Guests) VALUES('$RoomID','$Date','$Time_Start','$Time_Finish','$Persons_inc','$Guests')";
    $result = mysql_query($sql, $db) or die ("Invalid query");
    echo "<b>Submission Added</b><br><br>";
    }


    if (isset($_POST['action2']) == 'submitted'){
    echo "you would like to delete";
    $array = explode(",",$delete);
    //$sql = "DELETE FROM timetable WHERE RoomID='$array[0]' AND Date='$array[1]' AND Time_Start='$array[2]'";
    $sql = "DELETE FROM timetable WHERE RoomID='$row[RoomID]' AND Date='$row[Date]' AND Time_Start='$row[Time_Start]'";
    $result = mysql_query($sql, $db) or die ("Invalid query");
    }
    ?>
    </tr></table>

  21. #21
    SitePoint Evangelist nick0161's Avatar
    Join Date
    Oct 2004
    Location
    australia
    Posts
    424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmmm no error, with that last $sql code, however, no record deleted either

    i realised why i couldnt delete the whole db before. had wrong page open... oops!

  22. #22
    SitePoint Zealot devscripts's Avatar
    Join Date
    Sep 2004
    Location
    ur monitor
    Posts
    175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok now tell me about this line near the end

    $array = explode(",",$delete);

    where did u get $delete from?
    "None of you [truly] believes until he wishes for his brother what he wishes for himself." By The one and Only Prophet Mohammed (Peace and blessings be upon him)

  23. #23
    SitePoint Evangelist nick0161's Avatar
    Join Date
    Oct 2004
    Location
    australia
    Posts
    424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    what was that first $sql you asked me to try before....i wouldn't mind trying it again, i can't see it in any previous posts....

  24. #24
    SitePoint Zealot devscripts's Avatar
    Join Date
    Sep 2004
    Location
    ur monitor
    Posts
    175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    to test, first do this

    print_r($array); and tell me wot it gives you.
    "None of you [truly] believes until he wishes for his brother what he wishes for himself." By The one and Only Prophet Mohammed (Peace and blessings be upon him)

  25. #25
    SitePoint Evangelist nick0161's Avatar
    Join Date
    Oct 2004
    Location
    australia
    Posts
    424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    $array = explode(",",$delete);

    i have no idea about this line, it's from a tute i did, i don't understand myself...hmm i commented it just then and it didn't make any different.... hmmm

    i presumed it had something to do with
    echo "<input type=\"radio\" value=\"$row[RoomID],$row[Date],$row[Time_Start]\" name=\"delete\"></td></tr>";


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
  •