Jump to content

listing.


grlayouts

Recommended Posts

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
https://forums.phpfreaks.com/topic/47372-listing/page/2/#findComment-231294
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
https://forums.phpfreaks.com/topic/47372-listing/page/2/#findComment-231304
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
https://forums.phpfreaks.com/topic/47372-listing/page/2/#findComment-231310
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
https://forums.phpfreaks.com/topic/47372-listing/page/2/#findComment-231325
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
https://forums.phpfreaks.com/topic/47372-listing/page/2/#findComment-231329
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
https://forums.phpfreaks.com/topic/47372-listing/page/2/#findComment-231344
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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