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 11-11-2013, 07:09 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,866
Infernette is on a distinguished road
Default Random question time!

How do you get the name and the id of the creature to show in a drop down list? I can get one or the other to show, but not both. I used to know this but now I seemed to have forgot- It would be nice to know how to do it again, and even how to get it to show images would be awesome!
__________________
No, I have no idea what I'm doing. But it works. Barely.
Reply With Quote
  #2  
Old 11-11-2013, 07:46 PM
IntoRain's Avatar
IntoRain IntoRain is offline
Moderator
 
Join Date: Jul 2013
Location: Portugal
Posts: 461
Gender: Female
Credits: 19,379
IntoRain is on a distinguished road
Default

Image I don't know if it's possible, but to add the code next to the name I don't really remember how I did it, but I believe I just went to the dropdown list creation and instead of sending just the name i send the code concatenated with the name, like:

$nameFinal = $name .= '( ' .= $code .= ')'

or something alike


edit:

I have this for females in the breeding thing

PHP Code:
$index 0;
            foreach(
$femaleNames as $namesF){
                    
//echo $femaleIDsarray[$index];
                    
$equals " (";
                    
$equals2 ")";
                    
$nameAndID $namesF .= $equals .= $femaleIDsarray[$index] .= $equals2;
                    
//echo $nameAndID;
                    
                    //echo $femaleIDsarray[$index];
                    
$female->add(new Option($nameAndID$femaleIDsarray[$index]));
                    
$index++;
            } 
__________________


asp.net stole my soul.

Last edited by IntoRain; 11-11-2013 at 07:51 PM.
Reply With Quote
  #3  
Old 11-11-2013, 08:27 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,866
Infernette is on a distinguished road
Default

I can't seem to get it to work, I get this :
Adopt/Price:Cannot fill option objects inside this dropdownlist
As an error, code:
PHP Code:
        $ids $mysidia->db->select("owned_adoptables", array("aid"), "owner = '{$mysidia->user->username}' AND bred != 'comp' AND attached = 'no' and currentlevel > 6 and selling = 'no'")->fetchAll(PDO::FETCH_COLUMN);    
        
$names1 $mysidia->db->select("owned_adoptables", array("name"), "owner = '{$mysidia->user->username}' AND bred != 'comp' AND attached = 'no' and currentlevel > 6 and selling = 'no'")->fetchAll(PDO::FETCH_COLUMN);

$index 0
            foreach(
$names1 as $names){ 
                    
$equals " ("
                    
$equals2 ")"
                    
$nameFinal $names .= $equals .= $ids[$index] .= $equals2
                     
                    
$index++; 
            }  
        
$adoptable->fill($nameFinal$ids);
        
        
$chooseFrom->add($adoptable); 
__________________
No, I have no idea what I'm doing. But it works. Barely.
Reply With Quote
  #4  
Old 11-12-2013, 06:14 AM
IntoRain's Avatar
IntoRain IntoRain is offline
Moderator
 
Join Date: Jul 2013
Location: Portugal
Posts: 461
Gender: Female
Credits: 19,379
IntoRain is on a distinguished road
Default

I see, because you are using the fill function. In mine I add the options one by one to the dropdown list (called 'female'), so the left side is the field name and the right side the value. Try it like that?
__________________


asp.net stole my soul.
Reply With Quote
  #5  
Old 11-12-2013, 06:21 AM
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,866
Infernette is on a distinguished road
Default

I changed it to fill, but now it only shows one of the adoptables.

Updated code:
PHP Code:
        $ids $mysidia->db->select("owned_adoptables", array("aid"), "owner = '{$mysidia->user->username}' AND bred != 'comp' AND attached = 'no' and currentlevel > 6 and selling = 'no'")->fetchAll(PDO::FETCH_COLUMN);    
        
$names1 $mysidia->db->select("owned_adoptables", array("name"), "owner = '{$mysidia->user->username}' AND bred != 'comp' AND attached = 'no' and currentlevel > 6 and selling = 'no'")->fetchAll(PDO::FETCH_COLUMN);

$index 0
            foreach(
$names1 as $names){ 
                    
$equals " ("
                    
$equals2 ")"
                    
$nameFinal $names .= $equals .= $ids[$index] .= $equals2
                     
                    
$index++; 
            }  
        
$adoptable->add(new Option($nameFinal$ids[$index]));
        
        
$chooseFrom->add($adoptable); 
__________________
No, I have no idea what I'm doing. But it works. Barely.
Reply With Quote
  #6  
Old 11-12-2013, 06:25 AM
IntoRain's Avatar
IntoRain IntoRain is offline
Moderator
 
Join Date: Jul 2013
Location: Portugal
Posts: 461
Gender: Female
Credits: 19,379
IntoRain is on a distinguished road
Default

Oh, the add goes inside the the foreach cycle
__________________


asp.net stole my soul.
Reply With Quote
  #7  
Old 11-12-2013, 05:37 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,866
Infernette is on a distinguished road
Default

Works now, awesome!
__________________
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
Long Time No See DarthPhoenix Newcomer Center 1 11-08-2014 05:52 PM
Last time I hope RoconzaArt Questions and Supports 4 01-17-2011 09:30 AM
over time to train focap17 Questions and Supports 0 06-23-2010 11:23 AM
Random 5 is not realy random! RipJawWolfFang Questions and Supports 9 04-30-2009 06:03 AM
when you have time i need a little help. agnyz Questions and Supports 7 01-17-2009 03:12 PM


All times are GMT -5. The time now is 10:50 AM.

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