From 3652c64d5172305d8eb4eaa09c16d68eb4484106 Mon Sep 17 00:00:00 2001 From: hecht Date: Thu, 20 Oct 2016 19:56:53 +0000 Subject: [PATCH] neue Turniere: Cronjobs implementiert --- cronjob/inclu/fruitdistribution.inc.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/cronjob/inclu/fruitdistribution.inc.php b/cronjob/inclu/fruitdistribution.inc.php index fc7ab3a..86b64ca 100644 --- a/cronjob/inclu/fruitdistribution.inc.php +++ b/cronjob/inclu/fruitdistribution.inc.php @@ -21,4 +21,20 @@ function distributeFruit($user_id) { echo $sql . '
'; mysql_query($sql); } -?> \ No newline at end of file + +function distributeParamecia($user_id) { + $sql = 'SELECT id FROM wochen_markt WHERE kategorie=\'Paramecia\''; + $qry = mysql_query($sql); + $amount = mysql_num_rows($qry); + while($fruit = mysql_fetch_assoc($qry)) { + $fruits[] = $fruit; + } + + $choice = mt_random_wrapper(0,$amount-1); + $sql = 'INSERT wochen_ware SET item='.$fruits[$choice]['id'].', user='.$user_id; + echo $sql . '
'; + mysql_query($sql); +} + + +?>