Temos pavadinimas: WordPress, Shopify ir PHPFusion programuotojų bendruomenė :: Month top 5 script

Parašė JaWa· 2014 Gru. 3 18:12:47
#1

Galite pagelbeti su kodu, man vis nesigauna padaryti, kad pavyzdziui kreditus skirtu pirmom 3 vietoms. Nes kaip sitam pavyzdyje yra, tai 200 kreditu duoda tik uz 1 vieta. Ivairiai bandziau daryti.


Kodas originalas:

<?php
 
//////////////////menesio TOP tikrinimas/davimas //////////////////
 
if ( file_get_contents ( 'txt/belekoks_m.txt' ) != date ( 'Y.m' ) )
{
include_once("config2.php");
$get_tops1=mssql_query("Select Name,Accountid,mrr from Character order by mrr DESC, name DESC");
for ($i=0;$i< 1; $i++) {
$tops1 = mssql_fetch_row($get_tops1);
  $res1 = mssql_query("update MEMB_CREDITS set credits=credits+200 where memb___id='$tops1[1]'");
  }
  $fp1 = fopen("txt/belekoks_m.txt", "w");
 
if (flock($fp1, LOCK_EX)) {
    fwrite($fp1, date ( 'Y.m' ));
    flock($fp1, LOCK_UN);
}
fclose($fp1);
 
  $res1 = mssql_query("update Character set mrr=0");
 
} 
?>


variantai:


<?php
 
//////////////////menesio TOP tikrinimas/davimas //////////////////
 
if ( file_get_contents ( 'txt/belekoks_m.txt' ) != date ( 'Y.m' ) )
{
include_once("config2.php");
$get_tops1=mssql_query("Select Name,Accountid,mrr from Character order by mrr DESC, name DESC");
for ($i=0;$i< 1; $i++) {
$tops1 = mssql_fetch_row($get_tops1);
  $res1 = mssql_query("update MEMB_CREDITS set credits=credits+200 where memb___id='$tops1[1]'");
  $res2 = mssql_query("update MEMB_CREDITS set credits=credits+100 where memb___id='$tops1[2]'");
  }
  $fp1 = fopen("txt/belekoks_m.txt", "w");
 
if (flock($fp1, LOCK_EX)) {
    fwrite($fp1, date ( 'Y.m' ));
    flock($fp1, LOCK_UN);
}
fclose($fp1);
 
  $res1 = mssql_query("update Character set mrr=0");
 
} 
?>


Tada visiems duoda po 200 ... Zodziu jau nervai nelaiko :D Gal kas turite kokiu pasiulymu ?

Parašė Ponas24· 2014 Gru. 3 19:12:26
#2


<?php
 
//////////////////menesio TOP tikrinimas/davimas //////////////////
 
if ( file_get_contents ( 'txt/belekoks_m.txt' ) != date ( 'Y.m' ) )
{
include_once("config2.php");
$get_tops1=mssql_query("Select Name,Accountid,mrr from Character order by mrr DESC, name DESC LIMIT 3");
while ($tops1 = mssql_fetch_row($get_tops1)) {
$res1 = mssql_query("update MEMB_CREDITS set credits=credits+200 where memb___id='$tops1[1]'");
}
$fp1 = fopen("txt/belekoks_m.txt", "w");
 
if (flock($fp1, LOCK_EX)) {
fwrite($fp1, date ( 'Y.m' ));
flock($fp1, LOCK_UN);
}
fclose($fp1);
 
$res1 = mssql_query("update Character set mrr=0");
 
} 
?>

Parašė JaWa· 2014 Gru. 3 20:12:10
#3

Ponas24 parašė:

<?php
 
//////////////////menesio TOP tikrinimas/davimas //////////////////
 
if ( file_get_contents ( 'txt/belekoks_m.txt' ) != date ( 'Y.m' ) )
{
include_once("config2.php");
$get_tops1=mssql_query("Select Name,Accountid,mrr from Character order by mrr DESC, name DESC LIMIT 3");
while ($tops1 = mssql_fetch_row($get_tops1)) {
$res1 = mssql_query("update MEMB_CREDITS set credits=credits+200 where memb___id='$tops1[1]'");
}
$fp1 = fopen("txt/belekoks_m.txt", "w");
 
if (flock($fp1, LOCK_EX)) {
fwrite($fp1, date ( 'Y.m' ));
flock($fp1, LOCK_UN);
}
fclose($fp1);
 
$res1 = mssql_query("update Character set mrr=0");
 
} 
?>


Situo atveju visi 3 gaus po 200 kredu, per riebu yra ... Reikia kad 1 vieta 200 , 2 vieta 100 , 3 vieta 50

Parašė Žmogus· 2014 Gru. 5 15:12:52
#4

Tada gali while cikle pridėti kokį skaitliuką ir pridėti kintamąjį ir daryti tikrinimą ar pirmas antras ir t.t. ir uždėti tą skaičių