[RESOLVED KINDA] the dreadful SpaCe
okay i have this code... and it works fine. or so i thought...
PHP Code:
case "remove_trainer":
if (is_array($_POST['rem_trainer'])) {
foreach($_POST['rem_trainer'] as $trainer) {
$trainer = addslashes($trainer); // use if magic quotes is disabled
mysql_query("UPDATE members SET trainer = 0 WHERE username = '$trainer'") or die(mysql_error());
echo "Removed trainer $trainer from list.<BR>";
}
}
echo"<form action=index.php?console&OPT=remove_trainer method=post>
<table width=100% border=0 cellspacing=0 cellpadding=0>
<tr>
<td scope=col>Remove Trainer(s): </td>
</tr>
";
$sql = "SELECT * FROM members WHERE trainer = 1";
$result = mysql_query($sql) or die(mysql_error());
while($row = mysql_fetch_array($result)) {
echo" <tr>
<td scope=col><input name=rem_trainer[] type=checkbox value=$row[username]>$row[username]</td>
</tr>";
}
echo"
<tr>
<td scope=col><input type=submit name=removed value='Remove Trainer'></td>
</tr>
</table>
</form>";
break;
the ONLY PROBLEM IS... it wont UPDATE anything with spaces in it...I tried replacing the (space) with the and it didnt help...