Jump to content
php.lv forumi

ORDER BY


djmartins

Recommended Posts

<?php

$lietotaji=mysql_query("select * from users") or die(mysql_error());
while($users=mysql_fetch_array($lietotaji)) {


$count=mysql_query("select COUNT(id) As daudzums from movie where niks='$users[1]' group by autors 

HAVING count(id) > '0' ORDER By daudzums DESC") or die(mysql_error());
while($rezultats=mysql_fetch_array($count)) {
echo"$users[1] $rezultats[0]<br>";
} }
?>

 

 

Problēma ir tajā, ka nesakārto saskaitītos rezultātus dilstošā secībā. Tiek izvadīts šādi -> juris 4 maris 1 edgars 3

 

Taču vajadzētu šādi -> juris 4 edgars 3 maris 1

 

Kur man varētu būt kļūda?

Link to comment
Share on other sites

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.   Paste as plain text instead

  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.

Loading...
×
×
  • Create New...