Scratch that, lol... that was hard... Ok I had to pick through... is this right?
Code:
// Begin the output of all the adoptables to the user...
$uncommon = rand(1,50);
$rare = rand(1,100);
$ultrarare = rand(1,200);
if ($uncommon==1){
$query = "SELECT * FROM ".$prefix."adoptables WHERE rarity='1' ORDER BY RAND() LIMIT 1";
}
else if ($rare==1){
$query = "SELECT * FROM ".$prefix."adoptables WHERE rarity='2' ORDER BY RAND() LIMIT 1";
}
else if ($ultrarare==1){
$query = "SELECT * FROM ".$prefix."adoptables WHERE rarity='3' ORDER BY RAND() LIMIT 1";
}
else{
$query = "SELECT * FROM ".$prefix."adoptables WHERE rarity='0' ORDER BY RAND() LIMIT 1";
}
$stmt = $adopts->query($query);
$article_content .= "
<table class='adopt'><tr>";
while($row = $stmt->fetch(PDO::FETCH_OBJ)) {
$aid=$row->id; //The adoptable's ID
$type=$row->type;
$description=$row->description;
$eggimage=$row->eggimage;
// Call a function to check if we have the proper privledge level to adopt this pet
if($promocode == "") $promocode = "none";
$canadopt = canadopt($aid, "showing", $promocode, $row); // Feed an adoptable ID and showing, to show the adopt to guests...
if($canadopt == "yes"){
//If we can adopt the adoptable, show the image and adoption link...
$article_content .= "
<td VALIGN='top'><br><br><br><br><br><br><br><br><br><br><a href='doadopt.php?id=".$aid."'><img src='picuploads/png/e42598f988b271a7e66b36b9a5d8143b.png' /></a><br>
{$description}</td>";
}
}
if ($uncommon==1){
$query = "SELECT * FROM ".$prefix."adoptables WHERE rarity='1' ORDER BY RAND() LIMIT 1";
}
else if ($rare==1){
$query = "SELECT * FROM ".$prefix."adoptables WHERE rarity='2' ORDER BY RAND() LIMIT 1";
}
else if ($ultrarare==1){
$query = "SELECT * FROM ".$prefix."adoptables WHERE rarity='3' ORDER BY RAND() LIMIT 1";
}
else{
$query = "SELECT * FROM ".$prefix."adoptables WHERE rarity='0' ORDER BY RAND() LIMIT 1";
}
$stmt = $adopts->query($query);
$article_content .= "
<table class='adopt'><tr>";
while($row = $stmt->fetch(PDO::FETCH_OBJ)) {
$aid=$row->id; //The adoptable's ID
$type=$row->type;
$description=$row->description;
$eggimage=$row->eggimage;
// Call a function to check if we have the proper privledge level to adopt this pet
if($promocode == "") $promocode = "none";
$canadopt = canadopt($aid, "showing", $promocode, $row); // Feed an adoptable ID and showing, to show the adopt to guests...
if($canadopt == "yes"){
//If we can adopt the adoptable, show the image and adoption link...
$article_content .= "
<td VALIGN='top'><br><br><br><br><br><br><br><br><br><br><a href='doadopt.php?id=".$aid."'><img src='picuploads/png/e42598f988b271a7e66b36b9a5d8143b.png' /></a><br>
{$description}</td>";
}
}
if ($uncommon==1){
$query = "SELECT * FROM ".$prefix."adoptables WHERE rarity='1' ORDER BY RAND() LIMIT 1";
}
else if ($rare==1){
$query = "SELECT * FROM ".$prefix."adoptables WHERE rarity='2' ORDER BY RAND() LIMIT 1";
}
else if ($ultrarare==1){
$query = "SELECT * FROM ".$prefix."adoptables WHERE rarity='3' ORDER BY RAND() LIMIT 1";
}
else{
$query = "SELECT * FROM ".$prefix."adoptables WHERE rarity='0' ORDER BY RAND() LIMIT 1";
}
$stmt = $adopts->query($query);
$article_content .= "
<table class='adopt'><tr>";
while($row = $stmt->fetch(PDO::FETCH_OBJ)) {
$aid=$row->id; //The adoptable's ID
$type=$row->type;
$description=$row->description;
$eggimage=$row->eggimage;
// Call a function to check if we have the proper privledge level to adopt this pet
if($promocode == "") $promocode = "none";
$canadopt = canadopt($aid, "showing", $promocode, $row); // Feed an adoptable ID and showing, to show the adopt to guests...
if($canadopt == "yes"){
//If we can adopt the adoptable, show the image and adoption link...
$article_content .= "
<td VALIGN='top'><br><br><br><br><br><br><br><br><br><br><a href='doadopt.php?id=".$aid."'><img src='picuploads/png/e42598f988b271a7e66b36b9a5d8143b.png' /></a><br>
{$description}</td>";
}
}