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
512 B

13 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_affected_rows($qry);
while($fruit = mysql_fetch_assoc($qry)) {
$fruits[] = $fruit;
}
$choice = mt_rand(0,$amount-1);
$sql = 'INSERT wochen_ware SET item='.$fruits[$choice].', user='.$user_id;
echo $sql;
mysql_query($sql);
}
?>