Re: Month top 5 script php
Re: Month top 5 script php
I edit your code however, I cant understand.
MRR column: do you have to reset on 1st of every Month(Can you create a job on SQL)
And the text file is for log you?
Quote:
<?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 TOP 5 Name,Accountid,mrr from Character order by mrr DESC, name DESC");
for ($i=0;$i<= 5; $i++) {
$tops1 = mssql_fetch_row($get_tops1);
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");
}
?>