I am trying to show a list of information using a FETCH and WHERE statements.

This is my code:

$buds = mysql_query("SELECT * FROM buds2 WHERE bud_me = '$userid' AND confirmed= '1'");

$x = 1;
while ($array = mysql_fetch_array($buds))
	$buddy = fetch("SELECT display_name,username FROM members2 WHERE id = '$array[bud_you]' AND game = '$game'");
	$buddy2 = fetch("SELECT photo_selected,location,my_update FROM members_profiles2 WHERE username = '$buddy[username]' AND game = '$game'");

	if (!$array[bud_note]) { $array[bud_note] = "<i>No notes on this buddy.</i>"; }

	$mybuds .= "
			<TD VALIGN=top><center>
			 <P><a target=_blank href=user_profile.php?user=$buddy[username]&game=$game><FONT SIZE=\"+1\"
			 <BR><img src='photos/$buddy2[photo_selected]' width=80 ><FONT SIZE=\"-1\"><I>
			 <a href=buds_edit.php?game=$game&bud=$array[bud_you]>Edit</a>,
		     <a href=delete_bud.pro.php?game=$game&bud=$array[bud_you]><font
			 <P><font size=-1><B>Notes:</B> $array[bud_note]</font></P>

I can get this code to work normally WITHOUT using the WHERE confirmed='1' code but whenever I try to use this it just doesnt show anything from the table!

Please Help

Many Thanks

Hmm dunno how but there is an extra confirmed in this line of code:

$buds = mysql_query("SELECT * FROM buds2 WHERE bud_me = '$userid' AND confirmed= '1'");

This is only ONE AND confirmed in the code!

I see all your ID's are quoted. If they are integers, they shouldn't be. Only strings and string-like data should be quoted.

I also can not find any reference to the fetch() function you are using. Is this something you made, or from some 3'rd party include?

This article has been dead for over six months. Start a new discussion instead.