Jump to content

Noobie ?


Greaser9780

Recommended Posts

I am try to display data from my table in order of which clan has the most wins. Here is my code:

$sql="SELECT `clan_name` FROM `bhdsingle`  ORDER BY  `wins`";

$res=mysql_query($sql) or die(mysqll_error());

while ($list = mysql_fetch_array($res)) {

      echo "{$list['clan_name']} <br>";

   }

 

It set up a list but puts least wins first. What else can I use?

ORDER BY DESCENDING `wins`?

Link to comment
https://forums.phpfreaks.com/topic/38595-noobie/
Share on other sites

Figured it out by searching previous posts.TY though.

Maybe you could help me with something else. Now I am trying to SELECT multiple things from the same query and list them the same way. I tried the following but got nowhere:

$sql="SELECT (`clan_name`,`wins`,`losses`) FROM `bhdsingle`  ORDER BY `wins` DESC";

$res=mysql_query($sql) or die(mysqll_error());

while ($list = mysql_fetch_array($res)) {

      echo "{$list['clan_name']}{$list['wins']}{$list['losses']} ";

  }

 

Link to comment
https://forums.phpfreaks.com/topic/38595-noobie/#findComment-185235
Share on other sites

<?php
$sql="SELECT `clan_name`,`wins`,`losses` FROM `bhdsingle`  ORDER BY `wins` DESC";
$res=mysql_query($sql) or die(mysql_error()); //too many 'l' in mysql_error spelling
while ($list = mysql_fetch_array($res)) { 
      echo "".$list['clan_name']." - ".$list['wins']." - ".$list['losses'].""; 
   } 

?>

Link to comment
https://forums.phpfreaks.com/topic/38595-noobie/#findComment-185428
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.