Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Questions and Supports

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 03-09-2013, 02:29 PM
Infernette Infernette is offline
CODE CODE CODE CODE CODE
 
Join Date: Jan 2013
Location: Where I live? I live home.
Posts: 164
Gender: Female
Credits: 23,871
Infernette is on a distinguished road
Default Need a tad more help w/a page

So, I am finally setting up the adopt system that I have but the one thing I am running into is the page set up just doesn't work... Otherwise I can get it to work just fine.

I need to figure out how to get the page to show 3 random entries from the mysql database, instead of just one entry and a page that links to another. I hopefully need some help soon(trying to finish the basics so I can work on aesthetics), even if you just tell me how to make a simple page to pull 3 entries *with their same info and not just 3 random parts* and justify them (gah that would be great)...
[spoiler]
Code:
<?php 

require("inc/init.php"); 

//***************// 
//  START SCRIPT // 
//***************// 

if(!$mysidia->user->isloggedin){ 
   // The user is not logged in, show generic login error message 
   $mysidia->displayerror("guest"); 
} 
elseif(!$mysidia->input->action()){ 
   // No action specified yet, show the default page for myadopts.php 
   $mysidia->page->settitle($lang->title); 
   $totaladopts = $mysidia->db->query("SELECT count(*) FROM ".constant("PREFIX")."system_adoptables WHERE isavailable = 'yes'")->fetchColumn(); 
   $rowsperpage = 6; 
   $editer = "Would you like to adopt a pet?";
    
   $stmt = $mysidia->db->join("adoptables", "adoptables.type = system_adoptables.type") 
                       ->select("system_adoptables", array(), constant("PREFIX")."system_adoptables.isavailable = 'yes' ORDER BY RAND() LIMIT 1"); 
   $table = new Table("My Adopts", array(""));     
    $pagination = new Pagination($totaladopts, $rowsperpage); 
   $pagination->setPage($mysidia->input->get("page")); 
   while($adopt = $stmt->fetchObject()){ 
      $level = $mysidia->db->select("levels", array("primaryimage", "alternateimage","description"), "adoptiename='{$adopt->type}' AND thisislevel='{$adopt->currentlevel}'")->fetchObject(); 
      if($adopt->currentlevel == 0) $image = $adopt->eggimage;  
      elseif($adopt->usealternates == 'yes') $image = $level->alternateimage;  
      else $image = $level->primaryimage; 
	  if($adopt->currentlevel < '6') $gender = 'egg';
	  elseif($adopt->currentlevel == '6') $gender = 'hatchling';
	  else $gender = $adopt->gender;
	  if($adopt->currentlevel < '8') $abandon = "<a href='myadopts.php?action=pound&id={$adopt->aid}'>Abandon</a>•";
      elseif($adopt->currentlevel == '8')$abandon = ' ';
     if($adopt->currentlevel < '6' AND $adopt->isfrozen == "no") $freeze = ' ';
	        elseif($adopt->currentlevel < '8' AND $adopt->isfrozen == "no") $freeze = "<a href='myadopts.php?action=freeze&id={$adopt->aid}'>Freeze</a>•";

	        elseif($adopt->currentlevel > '6' AND $adopt->isfrozen == "no") $freeze = "<a href='myadopts.php?action=freeze&id={$adopt->aid}'>Freeze</a>•";
					elseif($adopt->isfrozen == "yes") $freeze = " ";
					else $freeze = " ";
	        if($adopt->isfrozen == "yes") $froze = "Frozen";
else $froze = " ";
	 if($adopt->currentlevel > '5') $rename = "<a href='myadopts.php?action=rename&id={$adopt->aid}'>Rename</a>•";
			else $rename = ' ';
	  if($adopt->currentlevel > '5') $name = "{$adopt->name}";
      elseif($adopt->currentlevel < '6') $name = "{$adopt->aid}";
if($adopt->currentlevel == 0) $description = "{$adopt->description}";
else $description = "{$level->description}";
      $table->buildtable(array("<a href='adopting.php?action=adopt&id={$adopt->aid}'><img src ='{$image}></a></img>"), "center"); 
      $mysidia->page->addcontent($table->showtable());       
   } 
    
   $mysidia->page->addcontent($table->endtable()); 
   $mysidia->page->addcontent("<br /><br />{$pagination->showPage()}</div>");    
} 
   elseif($mysidia->input->action() == "purchase"){
   $adopt = $mysidia->db->select("system_adoptables", array(), "isavailable='yes' and aid='{$mysidia->input->get("id")}'")->fetchObject();	  
$user = $mysidia->user->username;
      $image = getcurrentimage($adopt->aid);
      if(!$mysidia->input->post("adoptname")){
	     $renameform = "<img src='{$image}'><br>{$adopt->gender}<br><i>{$adopt->type}</i><br><br>{$adopt->speciesd}<br />Would you like to purchase {$adopt->name}, {$user}?<br /> <br><br>This pet costs {$adopt->price} blue stones.<br> </br>
						<form name='form1' method='post' action='buying.php?action=purchase&id={$adopt->aid}'><p>Confirm: 
						<input name='adoptname' type='int' id='adoptname'>
						<input name='id' type='hidden' id='id' value='{$adopt->aid}'>
						<input type='submit' name='Submit' value='Buy Adoptable'></p><br><i>You must enter a word or letter into the  box above to confirm your purchase.</form>";
	     $mysidia->page->settitle('Purchasing a pet');
		 $mysidia->page->addcontent($renameform);
	  }

         else{
         $adopt = $mysidia->db->select("system_adoptables", array(), "isavailable='yes' and aid='{$mysidia->input->get("id")}'")->fetchObject();	  
$mysidia->db->insert("messages", array("id" => NULL, "fromuser" => $user, "touser" => $adopt->owner, "status" => unread, "messagetitle" => 'Pet sold!', "messagetext" => 'Your pet has sold to this user. You have been given your asking price for the pet and it has been instantly rewarded to you.'));
	     $cost = $adopt->price;
		 $moneyleft = $mysidia->user->money - $adopt->price;
		 $owner = $mysidia->db->select("users", array(), "username='$adopt->owner'")->fetchObject();	  
		 $moneyearned = $owner->money + $adopt->price;
		 if($moneyleft >= 0){
            $mysidia->db->update("users", array("money" => $moneyearned), "username = '$adopt->owner'");
			$mysidia->db->update("system_adoptables", array("owner" => $user,"isavailable" => 'no'), "aid ='$adopt->aid'");
            $mysidia->db->update("users", array("money" => $moneyleft), "username = '$user'");
			$message = "<img src='{$image}'><br />You have purchased {$adopt->name}.<small><a href = 'buying.php'>Go back to the sales area.</a></small>";
            $mysidia->page->addcontent($message);
}
else {
$message = "You do not have enough money to purchase this pet.";
         }
	  }
}

//***************//
//  OUTPUT PAGE  //
//***************//

$mysidia->output(); 

?>
[/spoiler]

sorry I'm so confuzzled with this @.@
__________________
No, I have no idea what I'm doing. But it works. Barely.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help Making Stats Page = Click Page & Lineages? squiggler Questions and Supports 2 02-22-2014 04:42 AM
Adopt Page & Pound Page change? tahbikat Questions and Supports 3 02-14-2014 03:19 PM


All times are GMT -5. The time now is 01:20 PM.

Currently Active Users: 9708 (0 members and 9708 guests)
Threads: 4,080, Posts: 32,024, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636