Adding new adoptables?

Forum
Last Post
Threads / Messages

Slix

Member
Member
Joined
Jun 1, 2010
Messages
14
Points
0
Mysidian Dollar
0
Hey there.

I've made a system that pulls the available adoptables from the database and creates an egg every hour. Users can then adopt the eggs. However, since I made this, I haven't seen any alternate status eggs being made. Is there something wrong with my code or is it just bad luck?

Code:
$id = $_GET["id"];
$id = preg_replace("/[^a-zA-Z0-9s]/", "", $id);
$id = secure($id);

$genderratio = $_GET["genderratio"];
$genderratio = preg_replace("/[^a-zA-Z0-9\\040.]/", "", $genderratio);
$genderratio = secure($genderratio);

$query = "SELECT * FROM ".$prefix."adoptables WHERE whenisavail='always' ORDER BY RAND() LIMIT 2";
$result = mysql_query($query);
$num = mysql_num_rows($result);


$i=0;
while ($i < $num) {

$type=@mysql_result($result,$i,"type");

$genderratio=@mysql_result($result,$i,"genderratio"); 

$i++;

}


if($name == ""){
$name = $type;
}

//The gender mod
if($genderratio >= 0 and $genderratio < 101) {
$tempgender = rand(0, 100);
if($tempgender >= 0 and $tempgender < $genderratio) {
$gender = "Female";
unset($tempgender);
}
else {
$gender = "Male";
unset($tempgender);
}
}
else {
$gender = "Genderless";
}

// Now we determine if we are using alternate images or not

$alts = getaltstatus($id, 0, 0);

// Now we actually process the adoption and add it to the database...
// We need a unique code for the adoptable so we can show it to the user when we're done here...

$code = rand(1, 20000);

//ADDING NEW ADOPTABLES HERE

mysql_query("INSERT INTO ".$prefix."lab_adoptables VALUES ('', '$type', '$name','Username','0','0', '$code', '','$alts','notfortrade','no','$gender')");

I have a line in there for grabbing the alternate chances, but I don't know if there's something else wrong that I just don't see.

Any help would be greatly appreciated!
 

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,280
Messages
33,132
Members
1,603
Latest member
Monako
BETA

Latest Threads

Top