salukigirl
New Member
- Messages
- 78
- Reaction score
- 0
- Points
- 0
So this is pretty simple. I want to randomize input.
I'm making a pet game, and in this game animals have "stats" and when you buy an animal I want those stats to be randomized so you don't know what you are going to get.
These would be from 1-10
If that didn't make sense I'll try to explain it a bit more.
I have the ears stat and everything in the animal table in the database, but I want to randomize what each animal's actually stats are via the pet shop. This is what I have so far...
Note I haven't put in a place where it inserts the stats into the rats table because I'm not sure how to do that.
Any help is greatly appreciated.
I'm making a pet game, and in this game animals have "stats" and when you buy an animal I want those stats to be randomized so you don't know what you are going to get.
These would be from 1-10
If that didn't make sense I'll try to explain it a bit more.
I have the ears stat and everything in the animal table in the database, but I want to randomize what each animal's actually stats are via the pet shop. This is what I have so far...
PHP:
<?php
include ('connect.php');
?>
All rats costs 3000 RTD.
<?php
error_reporting(E_ALL^E_NOTICE);
?>
<form name="form 1" method="post" action="breeder.php">
Rat Name:
<input name="petname" type="text">
<br>
Rat Gender:
<select name="petgender">
<option value="Buck">Buck</option>
<option value="Doe">Doe</option>
</select>
<br>
Rat Image:
<input name="image" type="text"> From <a href=imagebank.php>Image Bank?</a>
<br>
<input type="submit" name="Submit" value="Buy Rat">
</form>
<?php
$name = trim($_POST['name']);
$color= trim($_POST['color']);
$gender = trim($_POST['gender']);
$image = trim($_POST['image']);
?>
<?php
$ownerid = $_SESSION['id']
?>
<?php
$pet = @mysql_query("INSERT INTO rats (owner, image, name, color, gender) VALUES ('$owner','$image','$name','$color','$gender')") or die ( 'error' . @mysql_error());
$result = @mysql_query("UPDATE players SET money=money-3000 WHERE id='$id'") or die ('could not update pets name');
echo "<br>Animal Created!<BR><BR>";
?>
Note I haven't put in a place where it inserts the stats into the rats table because I'm not sure how to do that.
Any help is greatly appreciated.