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 05-30-2017, 03:50 PM
aquapyrofan aquapyrofan is offline
Member
 
Join Date: Apr 2017
Posts: 48
Gender: Unknown/Other
Credits: 11,000
aquapyrofan is on a distinguished road
Default

Quote:
Originally Posted by Dinocanid View Post
To filter which pets show up in the dropdown, you use this for the conditions:
PHP Code:
$stmt $mysidia->db->select("owned_adoptables", array("name""aid"), "owner = '{$mysidia->user->username}' AND column = value"); 
So you would replace 'column' and 'value' with whatever you want. (you can use AND as much as you want too if you wanted to narrow it down further) Here is an example if it being used to only select pets that are level 3 or higher:
PHP Code:
$stmt $mysidia->db->select("owned_adoptables", array("name""aid"), "owner = '{$mysidia->user->username}' AND currentlevel >= 3"); 
And here is an example found in breeding.php, which narrows down the list to pets of a certain gender, level, and last time bred:
PHP Code:
$stmt $mysidia->db->select("owned_adoptables", array("name""aid"), "owner = '{$mysidia->user->username}' AND gender = 'f' AND currentlevel >= {$settings->level} AND lastbred <= '{$lasttime}'"); 
For getting the id of the pet, you have to use 'fetchmap', like this:
PHP Code:
$stmt $mysidia->db->select("owned_adoptables", array("name""aid"), "owner = '{$mysidia->user->username}' AND currentlevel >= 3");
        
$adopts $mysidia->db->fetchMap($stmt);
//code...
$petlist = new DropdownList("petlist");
          
$petlist->add(new Option("None Selected""none"FALSE));            
          
$petlist->fill($adopts);
$yourForm->add($petlist); 
That way the pet id is inserted into the database instead of the name, unlike it would've done if you used 'fetchlist', which would get the name but nothing else.
Is there a way to add the ID without the database call (say, another form element) so it can then be used elsewhere? I'm planning to try to do something with JavaScript and will need a way for it to know which pet the user is selecting.
Reply With Quote
Reply

Thread Tools
Display Modes

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


All times are GMT -5. The time now is 08:21 PM.

Currently Active Users: 3312 (0 members and 3312 guests)
Threads: 4,081, Posts: 32,032, 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 - 2025, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636