Dragen Posted April 17, 2007 Share Posted April 17, 2007 try switching the sql statement to this... $msel = mysql_query("select * from players where id=$startid && jail !='21' order by level desc limit 30"); I think the where id= should be $startid. That way it increases by one each time and displays a different user. Quote Link to comment Share on other sites More sharing options...
saint959 Posted April 17, 2007 Share Posted April 17, 2007 hi could you try this and see if it gives you an output? $msel = mysql_query("select * from players where id < $startid order by level desc limit 15"); while ($mem = mysql_fetch_array($msel)) { $stats1=$mem['level']; $stats2=$mem['max_hp']; $stats3=$mem['wins']; $stats4=$mem['exp']; $stats4=$mem['knowledge']; $stats6=$mem['losses']; $ranks=($stats1+$stats2+$stats3+$stats4-$stats5) echo $stats1 . " " . $stats2 . " " . $stats3 . " " . $stats4 . " " . $stats5 . " " . $stats6 . " " . $ranks . "<br />"; } Quote Link to comment Share on other sites More sharing options...
grlayouts Posted April 17, 2007 Author Share Posted April 17, 2007 no & no. still nothing. Quote Link to comment Share on other sites More sharing options...
Dragen Posted April 17, 2007 Share Posted April 17, 2007 just above the break; and an echo statement. while ($mem = mysql_fetch_array($msel)) { if($startid = $endid){ echo "end of list"; break; //if $startid reaches the $endid it stops listing users } if it echos the statement you know that for some reason $startid and $endid are the same.. Quote Link to comment Share on other sites More sharing options...
grlayouts Posted April 17, 2007 Author Share Posted April 17, 2007 i now think i have the completly wrong code.. can u clear up what i should have now? Quote Link to comment Share on other sites More sharing options...
Dragen Posted April 17, 2007 Share Posted April 17, 2007 well what I've got is: <?php $slctid = mysql_query("select * from players where id=$stat[id]");// selects the user that is viewing the page MUST BE DIFFERENT FROM $mem $startid = $slctid - 15; // sets the starting user as 15 before the viewer $endid = $slctid + 15; // ets the last user on the list as 15 after the viewer $msel = mysql_query("select * from players where id=$startid && jail !='21' order by level desc limit 30"); $ranka = 0; while($mem = mysql_fetch_array($msel)){ if($startid = $endid){ echo "end"; break; //if $startid reaches the $endid it stops listing users } $ranka++; $stats1=$mem['level']; $stats2=$mem['max_hp']; $stats3=$mem['wins']; $stats4=$mem['exp']; $stats4=$mem['knowledge']; $stats6=$mem['losses']; $ranks=($stats1+$stats2+$stats3+$stats4-$stats5); echo $stats1 . " " . $stats2 . " " . $stats3 . " " . $stats4 . " " . $stats5 . " " . $stats6 . " " . $ranks . "<br />"; $startid++; //increments to the user id } ?> what do you have? Quote Link to comment Share on other sites More sharing options...
grlayouts Posted April 17, 2007 Author Share Posted April 17, 2007 same still printing or displaying nothing. Quote Link to comment Share on other sites More sharing options...
Dragen Posted April 17, 2007 Share Posted April 17, 2007 okay, just before the last echo I've added another echo, just to check if it's getting that far before it hits a problem.. $ranks=($stats1+$stats2+$stats3+$stats4-$stats5); echo "list here"; echo $stats1 . " " . $stats2 . " " . $stats3 . " " . $stats4 . " " . $stats5 . " " . $stats6 . " " . $ranks . "<br />"; $startid++; //increments to the user id just wondering if perhaps changing the echo at the bottom would help.. just a long shot. echo $mem['level'] . " " . $mem['max_hp'] . " " . $mem['wins'] . " " . $mem['exp'] . " " . $mem['knowledge'] . " " . $mem['losses'] . " " . $ranks . "<br />"; also perhaps you could try it without the '' around the stats variables as it seemed to be at least echoing something at that point.. $stats1=$mem[level]; $stats2=$mem[max_hp]; $stats3=$mem[wins]; $stats4=$mem[exp]; $stats4=$mem[knowledge]; $stats6=$mem[losses]; just a couple of ideas Quote Link to comment Share on other sites More sharing options...
boo_lolly Posted April 17, 2007 Share Posted April 17, 2007 try this: $sql = " SELECT * FROM players WHERE jail != '21' ORDER BY level DESC LIMIT -15, 30 "; $query = mysql_query($sql) OR die($sql ."<br />\nCaused the folloing error: ". mysql_error()); see what that does. Quote Link to comment Share on other sites More sharing options...
grlayouts Posted April 17, 2007 Author Share Posted April 17, 2007 the problem seems to be $ranka = 0; echo "list here"; while($mem = mysql_fetch_array($msel)){ if($startid = $endid){ echo "end"; break; //if $startid reaches the $endid it stops listing users } $ranka++; nothing goes by this bit Quote Link to comment Share on other sites More sharing options...
grlayouts Posted April 17, 2007 Author Share Posted April 17, 2007 try this: $sql = " SELECT * FROM players WHERE jail != '21' ORDER BY level DESC LIMIT -15, 30 "; $query = mysql_query($sql) OR die($sql ."<br />\nCaused the folloing error: ". mysql_error()); see what that does. SELECT * FROM players WHERE jail != '21' ORDER BY level DESC LIMIT -15, 30 Caused the folloing error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-15, 30' at line 11 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.