This line is what puts the adoptable in to the DB, so i would suggest taking a look at it and see what it is sending to the database and if that is the problem.
PHP Code:
runquery("INSERT INTO {$prefix}owned_adoptables VALUES ('', '{$row['type']}', '$name','$loggedinname','0','0', '$code', '','$alts','fortrade','no', '$genders[$rand]','0')");
I would echo it out like this.
PHP Code:
$sql = "INSERT INTO {$prefix}owned_adoptables VALUES ('', '{$row['type']}', '$name','$loggedinname','0','0', '$code', '','$alts','fortrade','no', '$genders[$rand]','0')";
echo $sql;
runquery($sql);