Jump to content

listing.


grlayouts

Recommended Posts

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.

Link to comment
Share on other sites

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 />";

}

Link to comment
Share on other sites

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..

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.