Mikijs Posted February 21, 2008 Report Share Posted February 21, 2008 (edited) Iedomajamies situaciju kad janosaka cilveka numurs tatad nevis ID nemurs bet piem numurs ar kuru vinjs ir ORER By sarakstaa. //qverijs $sss=dbquery("SELECT * FROM ".PREF."lietotaji WHERE parole = '".$iMEMBER."'"); //parbaudam vai tads ir if(dbrows($sss)){ $pos=dbrows("SELECT * FROM ".PREF."lietotaji ORDER BY balsis DESC"); // te man itka butu kkas javeido =/ // bet nevaru iebraukt =/ // tatad ir sekojosie fieldi // // id <- pasi zinat kas // balsis <- balsu skaits (kam vairak tam jabut 1 vieta) un otradi } dbquery => mysql_query(); dbarray => mysql_fetch_assoc(); dbrows => mysql_num_rows(); dbarraynum => mysql_fetch_row(); galigi nesaprotu ka taisit un ka meklet.. Edited February 21, 2008 by Mikijs Link to comment Share on other sites More sharing options...
Mikijs Posted February 21, 2008 Author Report Share Posted February 21, 2008 ?! :) Link to comment Share on other sites More sharing options...
andrisp Posted February 21, 2008 Report Share Posted February 21, 2008 Ja vajag tikai attēlošanai, tad var ar html ol elementu. Link to comment Share on other sites More sharing options...
Mikijs Posted February 21, 2008 Author Report Share Posted February 21, 2008 ja vaig tikai attelosanai, ar kadu elementu? =/ tip while.. echo mysql_fetch_row("SELECT something FROM ".PREF."lietotaji WHERE id = '".$array['id']."'"); ? Link to comment Share on other sites More sharing options...
andrisp Posted February 21, 2008 Report Share Posted February 21, 2008 http://www.w3.org/TR/html401/struct/lists.html#h-10.2 un neiebraucu, ko tu gribēji pateikt ar to šo: tip while.. echo mysql_fetch_row("SELECT something FROM ".PREF."lietotaji WHERE id = '".$array['id']."'"); ? Link to comment Share on other sites More sharing options...
Aleksejs Posted February 21, 2008 Report Share Posted February 21, 2008 ?! :) Par šitādu dricelēšanos var arī nopelnīties, ka Tev principā neatbild! Vai Tev ir definēta konstante PREF? Vai Tu to obligāti gribi izdarīt SQL līdzekļiem? Varbūt ievies cikla mainīgo, kuru palielini par vienu, katru ierakstu nolasot. Link to comment Share on other sites More sharing options...
Mikijs Posted February 23, 2008 Author Report Share Posted February 23, 2008 nu ok meiginasu velreiz isuma paskaidrot Tatad pienjemsim ka ta ir balsosanas sistema ir 2 opcijas par ko balsot, vienai (a) ir 10 balsis bet otrai (b) 5, kaa lai es dabunu lai man uzrada ka (a) ir pirmā vietā, bet (b) ir otrā? Šobrīd pielietoju :P ORDER By balsis DESC... bet man nepieciešama izvade tieši tam, lai aprēķina ka tas ir pirmā vietā bet otrs ir otrā vietā Man šobrīd ir sekojošais Saraksts<br /><hr class="hr"><br /> <? $sql_saraksts=dbquery("SELECT * FROM ".PREF."lietotaji ORDER BY balsis DESC"); if (dbrows($sql_saraksts)){ while ($db=dbarray($sql_saraksts)){ echo "Par šo opciju nobalsots ".$db['balsis']." reizes"; } } ?> Vai Tev ir definēta konstante PREF? Jā ir require "config.php" define("PREF", $pref); Link to comment Share on other sites More sharing options...
Aleksejs Posted February 23, 2008 Report Share Posted February 23, 2008 Nu, teorētiski. SELECT id, name, (SELECT count(id)+1 FROM lietotaji l2 WHERE l1.sabalsotais > l2.sabalsotais AND l2.id <> l1.id) FROM lietotaji l1 ORDER BY balsis DESC" Apmēram tā... Nu tālāk kļūdas meklē pats. Link to comment Share on other sites More sharing options...
Recommended Posts