Hi make a cross back to PHP
I you access PHP do that so;
I mean if you have a command line
and you may say:
# php myscript.php
PHP Code:
$now = mktime();
$then = $now - (7*24*60*60);
/* Connecting, selecting database */
mysql_connect("localhost", "postdb_user", "postdb_passwd")
or die("Could not connect : " . mysql_error());
mysql_select_db("postdb") or die("Could not select database");
$query = "SELECT userid FROM post
WHERE dateline BETWEEN {$then} AND {$now}
GROUP BY userid
HAVING (COUNT(*) > 4);";
$result = mysql_query($query) or die("Query post failed : " . mysql_error());
$update = 'UPDATE user
SET usergroupid = 2, usertitle = "blah"
WHERE usergroupid = 14
AND userid NOT IN (';
// put users having at least 5
while ($postid = mysql_fetch_row($result) ) {
$update .= " '{$postid[0]}' , ";
}
// end with an empty not existing user, case list empty
$update .= " '' );";
$resupd = mysql_query($update) or die("Update user failed : " . mysql_error());
$nb = mysql_affected_rows ();
echo "\n $nb users updated\n";
It's tested out with ancient mysql versions 
He, r937, (I must remember it's as Boeing
still don't love PHP ?
à+
Bookmarks