Vilsol Posted March 27, 2011 Report Share Posted March 27, 2011 Tātad pieņemsim, ka man ir db kurā vienā tabulā ir komentāri un otrā useri. Lai izveidotu topu dilstošā secībā man vajadzēs ar while iet cauri visam useri db un skaitīt cik katram ir komentāri? Pēctam kā? Link to comment Share on other sites More sharing options...
ANALGINS Posted March 27, 2011 Report Share Posted March 27, 2011 (edited) uzkrāj summu iekš kāda ārēja mainīgā un izvadi, tad sakārto augošā vai dilstošā secībā, atkarībā kā tev vajag Edited March 27, 2011 by ANALGINS Link to comment Share on other sites More sharing options...
Vilsol Posted March 27, 2011 Author Report Share Posted March 27, 2011 paldies man jau sanāca bez useru tabulas šādi: $query = mysql_query("SELECT count(*), poster FROM comments GROUP BY poster ORDER BY count(*) DESC LIMIT 5"); Link to comment Share on other sites More sharing options...
Norek Posted April 2, 2011 Report Share Posted April 2, 2011 ja vēl Tu indeksētu poster lauku Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now