Menu
[code=php]<?
global $numc;
$rank6 = 1;
$crenum = mysql_query(“select * from `crew` order by ‘$numc’ desc limit 10 “) or die(mysql_error());
while ($crew1 = mysql_fetch_array($crenum)) {
$numc = mysql_num_rows(mysql_query(“select `crew` from `players` where `crew`=’$crew1[crewid]'”));?>
<?=$rank6?>
<?=$crew1[‘crewid’]?>
<?=$crew1[‘name’]?>
<?=$numc;?>
<?$rank6 += 1;?>
<? } ?>
ok i’m trying to make it order by the result of $numc(in descending order) but it will not do it
crew
[i]Originally posted by phpnovice [/i]
[B]Quotes are not allowed in the Order By clause. You can code it this way:
$crenum = mysql_query("select * fromorder by {$numc} desc limit 10 ") [/B][/QUOTE] crew
[i]Originally posted by outrage [/i]
[B]i wrote this code myself (otherwise it would be working) and no $rank6 isn't pointless its a rankings script so yes it does need it, $numc does carry a variable as mysql_num_rows counts the rows and gives the number of rows of players who have that crew id, and the only reason global $numc; is because it is supposed to carry the variable with the number, order by '$numc' desc isn't it supposed to order it by the num it gets from it come on i don't need advice :-/ i just need it fixed thats all and no you cannot just put ORDER BY DESC alone it will not work i know you are trying to help thanks and all but the code needs to be fixed thats all [/B][/QUOTE]
[i]Originally posted by outrage [/i]
[B]nope it says
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in standings.php on line 147 [/B][/QUOTE]
crew
crew
[code=php]
echo '<p>qry="{$qry}"</p>';
[/code]
[code=php]
echo '<p>qry="'.$qry.'"</p>';
[/code]
crew
[code=php]<?php
global $numc;
$numc = 1; // default order by column
... etc...
[/code]
crew
crewid
name
count(*)
crew
players
crewid
crew
0.1.9 — BETA 5.17