almightyegg Posted January 1, 2007 Share Posted January 1, 2007 i have a table of friends set out like this:id (primary key) 1 2friendid 1 8friendid2 2 406or whatever it maybe and i have a page listing all friends (where your id is friendid) except it counts the rows, but doesnt list the friends name....[code=php:0]<?$friendcount1 = mysql_query("SELECT * FROM friends WHERE friendid = '$GET'");$friends1 = mysql_num_rows($friendcount1);$friendcount2 = mysql_query("SELECT * FROM friends WHERE friendid2 = '$GET'");$friends2 = mysql_num_rows($friendcount2);$friends = $friends1+$friends2;?>You have <?echo "$friends ";if($firends > 1){echo "friends:";}elseif($friends == 0){echo "friends! Go get some now!!!!";}else{echo "friend:";}while($friendslot1 = mysql_fetch_array($friendcount1)){$friendslot1[friendid2] = $friendmain;$f1 = "SELECT * FROM users WHERE id = '$friendmain' LIMIT 1";$f2 = mysql_query($f1);$play = mysql_fetch_assoc($f2);echo "$play[firstn] $play[lastn]";}?>[/code] Quote Link to comment Share on other sites More sharing options...
chronister Posted January 1, 2007 Share Posted January 1, 2007 Your $_GET is missing some info... it should look like$_GET['XXX'];it is the ?XXX=somedata piece of the puzzle. $_GET is passing Array into your query, as $_GET[] is an array if you echo your query right below where you run it, I am sure you will see WHERE friendid='Array' same for the second one Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted January 1, 2007 Share Posted January 1, 2007 should'nt this:[code=php:0]$friendslot1[friendid2] = $friendmain;[/code]be this:[code=php:0]$friendmain = $friendslot1[friendid2];[/code]and what is $GET at the top, what have you defined it as. and change your echo down the botom to loook like this:[code=php:0]echo $play['firstn']." ".$play['lastn'];[/code] Quote Link to comment Share on other sites More sharing options...
almightyegg Posted January 2, 2007 Author Share Posted January 2, 2007 awesome it works!! the $GET was defined earlier, sorry i should have included that. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.