#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2000
    Location
    Johannesburg, South Africa
    Posts
    10
    Rep Power
    0
    Hi,

    I have a htm page where people select items via checkboxes - and the selected values get sent correctly to the PHP page as I include [] after the field name. I need some kind of loop to increment $i each time all the messages have been deleted - the for loop works nicely with 1 message which is checked, but when you check more than 1 it causes errors because it does not increase $1. Any suggestions ? :
    $dbName = "dbane";
    $MysqlName = "user";
    $MysqlPW = "passwd";
    mysql_connect("localhost");

    for ($i=0;$i<sizeof($messno);$i++) {
    mysql_connect("localhost",$MysqlName,$MysqlPW);
    $SelectStr = "SELECT * FROM archive WHERE Messno = '$messno[$i]'";
    $Results = MySQL($dbName,$SelectStr);
    $RowCount = MySQL_NUMROWS($Results);
    $messagelocat = "../clients/" . MySQL_RESULT($Results,$i,"Messagelocat");
    MySQL($dbName,"DELETE FROM messages WHERE Messno='$messno[$i]'");
    if (file_exists($messagelocat)) {
    unlink($messagelocat);
    }
    else
    {echo "There was no attachment to delete.";}

    }
    echo "<font face=Verdana><small>The selected
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2000
    Location
    Johannesburg, South Africa
    Posts
    10
    Rep Power
    0
    Not to worry guys - I FINALLY figured out what I did wrong. Guess I just needed a night's sleep.

Similar Threads

  1. Updating multiple rows with checkboxes
    By squidly in forum PHP Development
    Replies: 8
    Last Post: February 16th, 2004, 10:09 PM
  2. Using checkboxes to delete multiple items
    By MarlboroMan in forum Perl Programming
    Replies: 5
    Last Post: December 31st, 2003, 10:41 PM
  3. Replies: 2
    Last Post: October 8th, 2003, 01:26 AM
  4. Multiple checkboxes with same name??
    By cjgraphix in forum PHP Development
    Replies: 11
    Last Post: October 4th, 2003, 04:33 PM
  5. Getting data from multiple checkboxes
    By StevenC in forum Java Help
    Replies: 6
    Last Post: June 30th, 2003, 09:24 AM

IMN logo majestic logo threadwatch logo seochat tools logo