acegames Posted July 7, 2009 Share Posted July 7, 2009 Can anyone help me with this code please I need to add this query to the code so it gets results where friendid and requesterid both are approved ="1" $psql = mysql_query("SELECT * FROM `friends` WHERE `friendid`='$id' AND `approved`='1'", $conn); $psql = mysql_query("SELECT * FROM `friends` WHERE `requesterid`='$id' AND `approved`='1'", $conn); $num = mysql_num_rows($psql); $psql = mysql_query("SELECT * FROM `friends` WHERE `requesterid`='$id' AND `approved`='1' LIMIT $start , 5;", $conn); $left = mysql_num_rows($psql); ?> <? if($num>0) { while($prow = mysql_fetch_array($psql)) { $r = $prow["friendid"]; $n="navItem1"; $x=$x+1; if($x%2==0) { $n="navItem2"; } $sql1 = mysql_query("SELECT * FROM `members` WHERE `id`='$r'", $conn); while($row1 = mysql_fetch_array($sql1)) { $av = $row1["avatar"]; } if($av) { $av = "<a href=\"profile.php?id=$r\"><img src=\"$av\" class=\"img\" /></a>"; } else { $av = "<a href=\"profile.php?id=$r\"><img src=\"default.gif\" class=\"img\" /></a>"; } Link to comment https://forums.phpfreaks.com/topic/165071-help-with-join-query/ Share on other sites More sharing options...
fenway Posted July 10, 2009 Share Posted July 10, 2009 Are you just counting? A simple join would suffice. Link to comment https://forums.phpfreaks.com/topic/165071-help-with-join-query/#findComment-873094 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.