You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cacert-webdb/scripts/updatesort.php

19 lines
578 B
PHTML

18 years ago
#!/usr/bin/php -q
<?
18 years ago
include_once("/home/cacert/www/includes/mysql.php");
18 years ago
18 years ago
mysql_query("update `locations` set `acount`=0");
18 years ago
$query = "SELECT `users`.`locid` AS `locid`, count(*) AS `total` FROM `users`, `notary`
WHERE `users`.`id` = `notary`.`to` AND `users`.`locid` != 0
GROUP BY `users`.`id`, `users`.`locid`
HAVING sum(`notary`.`points`) >= 100";
$res = mysql_query($query);
while($row = mysql_fetch_assoc($res))
{
$query = "update `locations` set `acount`='${row['total']}' where `id`='${row['locid']}'";
18 years ago
// echo $query."\n";
18 years ago
mysql_query($query);
}
?>