You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
agng/cronjob/inclu/fruitdistribution.inc.php

24 lines
584 B

14 years ago
<?php
/*
*
* @copyright (c) 2010 animegame.eu
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public Licence
*
*/
include_once(ROOT_PATH. "/include/random.inc.php");
14 years ago
function distributeFruit($user_id) {
$sql = 'SELECT id FROM wochen_markt WHERE art=\'natur\'';
$qry = mysql_query($sql);
$amount = mysql_num_rows($qry);
14 years ago
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 . '<br>';
mysql_query($sql);
14 years ago
}
?>