Jump to content
php.lv forumi

stencilz

Reģistrētie lietotāji
  • Posts

    162
  • Joined

  • Last visited

Posts posted by stencilz

  1. iespējams ka daudz ko jaucu :)

     

    šeit ir strādājošs kods, bet kā lai iztaisa lai groupē sākot ar lietotāju kuram visvairāk rindu referal tabulā?

     

    	$q = mysql_query("SELECT t1.id,t1.user_name FROM users t1,referal t2 WHERE t1.id=t2.id GROUP BY t1.id");
    while($x = mysql_fetch_array($q))
      {
    	list($y) = mysql_fetch_row(mysql_query("SELECT COUNT(*) FROM referal WHERE id='".$x['id']."'"));
    	echo '<p>'.$x['user_name'].' ('.$y.')</p>';
      }

  2. $file = "max.txt";
    $open = fopen($file, "r+");
    $max = fread($open, filesize($file));
    if($count > $max)
     {
    fwrite($open, $count);
     }
    fclose($open);

     

    gribu ierakstīt maksimālo lietotāju skaitu, bet kā lai nodzēš iepriekšējo skaitu? man saglabā tā 0123...

×
×
  • Create New...