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 02-11-2017, 11:36 AM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 111,737
Abronsyth is on a distinguished road
Default Help with Dropdown list

Alrighty, so I am attempting to put together a dropdown list that will display a user's pets that are "no" for use alternates and level 4...I'm having issues with it.

I am just getting a blank drop-down list. Right now I'm just trying to list all of the user's pets.

Here's the code I'm attempting....

PHP Code:
$stmt $mysidia->db->select("owned_adoptables", array("name"), "owner = '{$mysidia->input->get("user")}'");
$name $stmt->fetchColumn();
$formExample = new Form("exampleform""page_to_send_to_here""post");
$exampleDropdown = new DropdownList("solarList");
$exampleDropdown->add(new Option("{$name}""{$name}"));
$formExample->add($exampleDropdown);
$formExample->add(new Button("Click Me""submit""submit"));
$document->add($formExample); 
This is my first time trying to work with dropdown lists in Mysidia, so I am very lost. If anyone could help I'd really appreciate it.
__________________
My Mods Site (1.3.4, 2020 Mods)

Last edited by Abronsyth; 02-11-2017 at 11:49 AM.
Reply With Quote
  #2  
Old 02-11-2017, 12:03 PM
Dinocanid's Avatar
Dinocanid Dinocanid is offline
Member
 
Join Date: Aug 2016
Location: Maryland, USA
Posts: 516
Gender: Unknown/Other
Credits: 63,715
Dinocanid is on a distinguished road
Default

To display all of a user's pets in a dropdown, there's this code
PHP Code:
$stmt $mysidia->db->select("owned_adoptables", array("name""aid"), "owner = '{$mysidia->user->username}'"); 
You can narrow down which adoptables are available in the dropdown, in your case by level and alternates, with something like this:
PHP Code:
$stmt $mysidia->db->select("owned_adoptables", array("name""aid"), "owner = '{$mysidia->user->username}' AND level >= '4' AND usealternates = 'no'"); 
It would also select adoptables who have a level higher than 4, since it uses ">=", but you could change it to just "=" if you only wanted level 4 pets to appear.
__________________

Last edited by Dinocanid; 02-11-2017 at 12:07 PM.
Reply With Quote
  #3  
Old 02-11-2017, 01:13 PM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 111,737
Abronsyth is on a distinguished road
Default

Thank you!

But I am still not sure how to actually get it to show that data in the drop down as options :/

By this I mean I'm not sure what to put here;
PHP Code:
$exampleDropdown->add(new Option("pet name?""aid?")); 
__________________
My Mods Site (1.3.4, 2020 Mods)

Last edited by Abronsyth; 02-11-2017 at 01:25 PM.
Reply With Quote
  #4  
Old 02-11-2017, 01:49 PM
Dinocanid's Avatar
Dinocanid Dinocanid is offline
Member
 
Join Date: Aug 2016
Location: Maryland, USA
Posts: 516
Gender: Unknown/Other
Credits: 63,715
Dinocanid is on a distinguished road
Default

Maybe this?:
PHP Code:
$options $mysidia->db->fetchList($stmt);
$exampleDropdown->fill($options); 
I'm going off of this here, maybe it can help?
__________________
Reply With Quote
  #5  
Old 02-11-2017, 04:42 PM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 111,737
Abronsyth is on a distinguished road
Default

Thank you for the link, that is helpful.

Hello!!
It is working :D

Thank you for all of your help, Dinocanid <3
__________________
My Mods Site (1.3.4, 2020 Mods)

Last edited by Abronsyth; 02-11-2017 at 04:44 PM.
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 01:30 AM.

Currently Active Users: 711 (0 members and 711 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