eM^ Posted October 8, 2006 Report Share Posted October 8, 2006 Palidziet man ar while izveidot top sistemu, starp speletajiem,kur sakartots peec punktu skaita. maaku taa lai topa ieliek parada visus lietotajus, bet gribu lai rada tikai top 10. Link to comment Share on other sites More sharing options...
bubu Posted October 8, 2006 Report Share Posted October 8, 2006 Ja izmanto SQL datubāzi, tad meklē savas datubāzes manuālī pie SELECT teikuma ORDER BY sadaļu. Ja to gribi realizēt tīrā php (tb neizmanto nekādu SQL), tad skaties uz funkciju sort. Link to comment Share on other sites More sharing options...
Delfins Posted October 9, 2006 Report Share Posted October 9, 2006 RTFM SQL. ORDER BY .. LIMIT 1,10 Link to comment Share on other sites More sharing options...
eM^ Posted October 9, 2006 Author Report Share Posted October 9, 2006 aa un ja es gribu piemeram otros talakos 10(10-20) tad LIMIT 10,20?? Link to comment Share on other sites More sharing options...
Delfins Posted October 9, 2006 Report Share Posted October 9, 2006 RTFM, jau apnikuši tādi jautājumi "ja gribu .., tad .. ?" Link to comment Share on other sites More sharing options...
GedroX Posted October 9, 2006 Report Share Posted October 9, 2006 RTFM SQL.ORDER BY .. LIMIT 1,10 .. LIMIT 0, 10 aa un ja es gribu piemeram otros talakos 10(10-20) tad LIMIT 10,20?? .. LIMIT 10, 10 Pirmais - offset Otrs - count P.S. RTFM Link to comment Share on other sites More sharing options...
eM^ Posted October 9, 2006 Author Report Share Posted October 9, 2006 nu kaa piemeram es varetu uztaisit lai man lapa jaunumus rada pirmos 10 un var spiest talakos 10? pirmajai lapai query LIMIT 1, 10 un otrai LIMIT 10 ,10? Link to comment Share on other sites More sharing options...
bubu Posted October 9, 2006 Report Share Posted October 9, 2006 Nē, pirmajai 0,10 otrajai 10,10, trešajai 20,10, ..., N-tajai N*10, 10 Link to comment Share on other sites More sharing options...
GedroX Posted October 9, 2006 Report Share Posted October 9, 2006 Nē, pirmajai 0,10 otrajai 10,10, trešajai 20,10, ..., N-tajai N*10, 10 N-tajai (N - 1)*10, 10 Link to comment Share on other sites More sharing options...
andrisp Posted October 9, 2006 Report Share Posted October 9, 2006 (edited) Rupjš piemērs Iekš bla.php $link_prev = $_GET['p'] - 1; $link_next = $_GET['p'] + 1; <a href="bla.php?p=<?php echo $link_prev; ?>">Prev</a> <a href="bla.php?p=<?php echo $link_next; ?>">Next</a> $offset = $_GET['p'] * 10; $sql = "SELECT ... LIMIT ".$offset.", 10"; Protams, jātaisa visāda veida pārbaudes: - $link_prev nav negatīvs. - $link_next * 10 nav lielāks par kopējo ierakstu skaitu - $_GET['p'] ir skaitlis - etc etc Edited October 9, 2006 by andrisp Link to comment Share on other sites More sharing options...
eM^ Posted October 9, 2006 Author Report Share Posted October 9, 2006 ok paldies Link to comment Share on other sites More sharing options...
bubu Posted October 9, 2006 Report Share Posted October 9, 2006 N-tajai (N - 1)*10, 10 Īsti programmētāji skaita no 0, nevis 1 :) Link to comment Share on other sites More sharing options...
GedroX Posted October 9, 2006 Report Share Posted October 9, 2006 Īsti programmētāji skaita no 0, nevis 1 :) Tad arī saki: ..nulltajai 0, 10, pirmajai 10, 10.. nevis: ..pirmajai 0,10 otrajai 10,10, trešajai 20,10, ..., N-tajai N*10, 10 Link to comment Share on other sites More sharing options...
bubu Posted October 9, 2006 Report Share Posted October 9, 2006 yes yes.. rakstīju vienu, domāju 0 ;) Link to comment Share on other sites More sharing options...
Delfins Posted October 9, 2006 Report Share Posted October 9, 2006 Nav nultās lapas, ir tikai index ar vērtību `0`. Link to comment Share on other sites More sharing options...
Recommended Posts