Ciao a tutti, io sto avendo problemi con questo script.
Dovrebbe ridarmi la classifica dei top 3 sponsor del mio sito, per qualche motivo quando la eseguo non succede nulla.
Vorrei precisare che questo è uno script che ho modificato, l'originale funziona.
Vi segno la parte che ho modificato, magari li ho fatto qualcosa di sbagliato.
Codice PHP:
<?php
include("config.php");
$rs = mysql_query("select * from users where active=1");
$i = 0;
while( $arr = mysql_fetch_array($rs) )
{
if( $arr[11] == "" )
{
}
else
{
$a[$i] = $arr[8];
$bb[$i] = $arr[11];
$i++;
}
}
if( 0 < $i ) {
$e = my_array_unique($bb);
for( $j = 0; $j < count($e);
$j++ ) {
$c[$j] = 0;
}
for( $j = 0; $j < count($e);
$j++ ) {
for( $l = 0; $l < count($bb);
$l++ ) {
if( $bb[$l] == $e[$j] )
{$c[$j] = $c[$j] + 1;
}
} }
$rs = mysql_query("drop table rank_ref");
$rs = mysql_query("create table rank_ref( ID text,ref int unsigned not null)");
for( $j = 0; $j < count($e);
$j++ ) {
$rs = mysql_query("" . "insert into rank_ref values('" . $e[$j] . "','" . $c[$j] . "')");
}
echo "<h2 align=center> Top 3 Sponsors </h2><font face=verdana size=2><center>";
$rs = mysql_query("select * from rank_ref order by ref desc limit 0,3");
while( $arr = mysql_fetch_array($rs) ) {
$rs1 = mysql_query("select * from users where status=2 and active=1 and ref_by='" . $arr["0"] . "' AND RDate >= '2014-06-24 00:00:00'");
$arr1 = mysql_fetch_array($rs1);
echo "" . "<br> User:" . $arr["0"] . ")";
} }
else {
echo "<br><br><Center>No Record Found with any sponsor</center><br><br>";
return NULL; } ?>
Questa è l'unica riga che ho modificato.
Codice PHP:
$rs1 = mysql_query("select * from users where status=2 and active=1 and ref_by='" . $arr["0"] . "' AND RDate >= '2014-06-24 00:00:00'");
Praticamente questa è una classifica per chi pubblicizza il sito, e vorrei far vedere dal 24 chi ha fatto registrare più persone.
Quel RDate è il dato della data di registrazione dell'utente.
Spero mi possiate aiutare, non riesco a capire dove sbaglio.
Grazie ragazzi!