i am writing something in php and i keep getting the error:
mysql_fetch_array not a valid sql argument. here is the code:

<?php
	if ($_GET['goto']=='requests'){
		?>
		<table>
		<?php
$query = "SELECT * FROM friends WHERE toid='$id'";
$result = mysql_query($query);
while($row = mysql_fetch_array($result)){
$query = "SELECT * FROM members WHERE toid='$row[fromid]'";
$result = mysql_query($query);
while($mem = mysql_fetch_array($result)){
	?>
		<td style='width:800px; height: 100px; color: white; vertical-align: center;'><img src='<?php echo $mem['pic'];?>'><?php echo "<a href='?goto=viewpro&uid=$mem[id]'>", $mem['name']," ", $mem['lname']; ?>
		<form name='accept' method='POST' action='?goto=accept'>
		<input type='hidden' name='fromid' value='<?php echo $row['fromid']; ?>'>
		<input type='submit' value='Accept'>
		</form>
		</td>
		<?php
}
}
?>
</table>
<?php
}
?>

You are redeclaring your variables inside your loops.
If you're looping over $result and than within that loop are setting $result to another value it will screw up the loop.