Forum Moderators: coopster
<?php
$IDArray =("");
// use a "for" loop to read and display array elements
for($count = 0; $count < sizeof($ID); $count++)
{
$IDArray[]=$ID[$count];
//print "'$ID[$count]', ";
}
print ("$IDArray")
?>
Sorry I think I have not explained myself well enough. The printing side of things was to show that the variables were being passed from the previous page from multiple checkboxes all asigned a name of ID[].
What I would like to do is insert the values into an array whic will then allow me to call the variable in an SQL delete statement. Block delete really. Just having emmense problems. As you can probably tell I am fumbling arond a littlewit this.
Cheers
//cut the trailing comma, (ergophobe's method, Lisa's admonishment)
Naw, I just stole it from someone who stole it from someone who stole it from someone. Once someone complained to Woody Guthrie that his songs were being plagiarized by another singer and Woody said "Aw, he ain't nothing. He just steals from me, but I steal from everybody."
Tom
For some reason though it throws an sql error. Wierd though, cos if I put the sql returned into phymyadmin it works. ??
The code is as follows
$sql = "DELETE FROM MMUser WHERE UserID IN (";
//add all of your values
foreach($IDArray as $key => $value) {
$sql .= "'$value',";
}
// remove the last comma and return
$sql = substr($sql, 0, -1);
//add the final parenthesis
$sql .= ")";