I have written a script that is supposed to look at the color of two animals and return a random possible baby outcome. This shows the basic idea.
$parents = array($dad1,$mom2);
if( in_array('Black Velvet',$parents, true) && in_array('Black Velvet',$parents, true) ) {
$result = Rand (1,3);
if ($result ==1){ $insert = mysql_query("INSERT INTO `pregnant` (`id`, `due_date`, `URL`) VALUES('$mom', '$due_date', \"limitedpetsadopt1.php?extra=2&new=7&mom=$mom&dad=$dad&bpoints=$bpoints\")"); print " Keep a close eye on your female over the next week and watch for babies";}
if ($result ==2){ $insert = mysql_query("INSERT INTO `pregnant` (`id`, `due_date`, `URL`) VALUES('$mom', '$due_date', \"limitedpetsadopt1.php?extra=2&new=2&mom=$mom&dad=$dad&bpoints=$bpoints\")"); print " Keep a close eye on your female over the next week and watch for babies";}
if ($result ==3){ print" <br><br><B>3 You bred two Velvet chinchillas together. <br> This baby got the Velvet gene from both parents which is the lethal gene. <br> It couldn't survive. You should consider not breeding Velvet to Velvet or White to White.";}
}
if( in_array('White Mosaic',$parents, true) && in_array('White Mosaic',$parents, true) ) {
$result = Rand (1,3);
if ($result ==1){ $insert = mysql_query("INSERT INTO `pregnant` (`id`, `due_date`, `URL`) VALUES('$mom', '$due_date', \"limitedpetsadopt1.php?extra=2&new=9&mom=$mom&dad=$dad&bpoints=$bpoints\")"); print " Keep a close eye on your female over the next week and watch for babies";}
if ($result ==2){ $insert = mysql_query("INSERT INTO `pregnant` (`id`, `due_date`, `URL`) VALUES('$mom', '$due_date', \"limitedpetsadopt1.php?extra=2&new=7&mom=$mom&dad=$dad&bpoints=$bpoints\")"); print " Keep a close eye on your female over the next week and watch for babies";}
if ($result ==3){ print" <br><br><B>4 You bred two White chinchillas together. <br> This baby got the White gene from both parents which is the lethal gene. <br> It couldn't survive. You should consider not breeding Velvet to Velvet or White to White.";}
}
if( in_array('Black Velvet',$parents, true) && in_array('White Mosaic',$parents, true) ) {
$result = Rand (1,4);
if ($result ==1){ $insert = mysql_query("INSERT INTO `pregnant` (`id`, `due_date`, `URL`) VALUES('$mom', '$due_date', \"limitedpetsadopt1.php?extra=2&new=7&mom=$mom&dad=$dad&bpoints=$bpoints\")"); print " Keep a close eye on your female over the next week and watch for babies";}
if ($result ==2){ $insert = mysql_query("INSERT INTO `pregnant` (`id`, `due_date`, `URL`) VALUES('$mom', '$due_date', \"limitedpetsadopt1.php?extra=2&new=2&mom=$mom&dad=$dad&bpoints=$bpoints\")"); print " Keep a close eye on your female over the next week and watch for babies";}
if ($result ==3){ $insert = mysql_query("INSERT INTO `pregnant` (`id`, `due_date`, `URL`) VALUES('$mom', '$due_date', \"limitedpetsadopt1.php?extra=2&new=9&mom=$mom&dad=$dad&bpoints=$bpoints\")"); print " Keep a close eye on your female over the next week and watch for babies";}
if ($result ==4){ $insert = mysql_query("INSERT INTO `pregnant` (`id`, `due_date`, `URL`) VALUES('$mom', '$due_date', \"limitedpetsadopt1.php?extra=2&new=10&mom=$mom&dad=$dad&bpoints=$bpoints\")"); print " Keep a close eye on your female over the next week and watch for babies";}
}
I tried the script with a black velvet bred to a white mosaic. Instead of going to that array and giving a possible outcome it returned the outcome for black to black and white to white. Can you help me find my error.