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

22 lines
521 B

14 years ago
<?php
/*
*
* @copyright (c) 2010 animegame.eu
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public Licence
*
*/
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_rand(0,$amount-1);
$sql = 'INSERT wochen_ware SET item='.$fruits[$choice]['id'].', user='.$user_id;
echo $sql . '<br>';
mysql_query($sql);
14 years ago
}
?>