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