PHP deleting users from db keeps deleting everyone!

Associate
Joined
4 Mar 2007
Posts
315
Location
United Kingdom
Anyone can tell me where I am going wrong here =/

PHP:
<?php	
	 if(!isset($cmd)){
		 $result = mysql_query("SELECT * FROM members WHERE username != '$myUsername' AND isAdmin = '0'");
			 while($row = mysql_fetch_array($result)){
					$id = $row['id'];
					$name = $row['username'];
							?>		
								<tr><td><? echo $row['username']; echo(" (<i> " . $row['status'] . "</i>)"); ?></td>
									<td>
										<a href="<?php echo "users.php?cmd=del&id=$id&user=$name" ?>"><img src="img/icons/action_add.gif" width="16" height="16" alt="add user"></img></a>
										<a href="#"><img src="img/icons/search.gif" width="16" height="16" alt="search users"></img></a>
										<a href="#"><img src="img/icons/file.gif" width="16" height="16" alt="back up user db"></img></a>
										<a href="#"><img src="img/icons/action_delete.gif" width="16" height="16" alt="delete user"></img></a>
										<a href="#"><img src="img/icons/application.gif" width="16" height="16" alt="mod rights"></img></a>
										<a href="#"><img src="img/icons/user.gif" width="16" height="16" alt="user profile"></img></a>
									</td>
								</tr>
							<?	
		//			}	
			 }   
		}
?>

<?
if($_GET["cmd"]=="del"){
$sql = "DELETE FROM members WHERE id = $id and username = $name";
$result = mysql_query($sql);
$row = null;
header("location: users.php");
}
?>
 
Back
Top Bottom