i am trying to execute a random query … at random 1-15 attacks
The below is a php query for a game.
it gets executed when a player hits the attack button. i simplified the query for simplicity’s sake.
In other words what im trying to do is///
randomly every 10 attacks to this specific ship_id run the query to insert
what i have so far is wrong in terms of the random generator but hopefully will make my point.
————————-The random hit would be below this line
**function RandNumber($e){
for($i=0;$i<$e;$i++){
$rand = $rand . rand(0, 9);
}
return $rand;
}
mysql_query("INSERT INTO {$game}_ships (ship_name,login_name,shipclass,class_name,class_name_abbr,fighters,max_fighters,max_shields,cargo_bays,mine_rate_metal,mine_rate_fuel,config,size,upgrades,move_turn_cost,point_value,location,login_id
) values(
'FC1','$user[login_name]','427','fc',' Sc','5967','5967','10442','2003','5','45','bs:dt:ot','6','99','19','45',1,'$user[login_id]')");
echo "<div class='success'>427 </div>";**
anyone can point me in the correct direction?
You need to track the hits if you want an exact number like every 10 hits, or every 9-15 hits.
you track it by running inserting a query every hit
then you fetch that same hits from the db and check whether it is 10
but if you want just by random from 1-15 regardless of hits count then: