0

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
}
?>
2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by mschroeder
0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.