
March 2nd, 2000, 01:45 PM
|
|
Junior Member
|
|
Join Date: Feb 2000
Location: Johannesburg, South Africa
Posts: 10
Time spent in forums: < 1 sec
Reputation 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
|