View Single Post
  #26  
Old 08-21-2013, 04:35 PM
Hwona's Avatar
Hwona Hwona is offline
Member
 
Join Date: Mar 2013
Posts: 620
Gender: Female
Credits: 50,322
Hwona is on a distinguished road
Default Re

Ah. I see! xP
Well, in that case, here's the code! :D

PHP Code:
function items_genderf($item$adopt){
        
$mysidia Registry:: get("mysidia");
        
//Let's check if the adoptable is already female.
        
$gender $mysidia -> db -> select ("owned_adoptables", array("gender"), "aid='{$adopt->aid}' and owner ='{$item->owner}'") -> fetchColumn();  
        if(
$gender == "f") {
            
//The adoptable is already female
            
$note "Your adoptable is already female.";
        }
        else{
            
//The adoptable is male. It's gender can be switched to female.
            
switch($adopt->gender){
                case 
"f":
                    
$mysidia -> db -> update("owned_adoptables", array("gender" => 'f'),"aid='{$adopt->aid}' and owner ='{$item->owner}'");
                    
$note "Your adoptable {$adopt->name} is now female.";
            }
            
//Update item quantity...
            
$delitem $item->remove();
        }
        return 
$note;
        } 
Edit: O.o Thank you guys sooooooo much! - It works! :D

Here's the finished code :D:
PHP Code:
function items_genderf($item$adopt){
        
$mysidia Registry:: get("mysidia");
        
//Let's check if the adoptable is already female.
        
$gender $mysidia -> db -> select ("owned_adoptables", array("gender"), "aid='{$adopt->aid}' and owner ='{$item->owner}'") -> fetchColumn();  
        if(
$gender == "f") {
            
//The adoptable is already female
            
$note "Your adoptable is already female.";
        }
        else{
            
//The adoptable is male. It's gender can be switched to female.
            
switch($adopt->gender){
                case 
"m":
                    
$mysidia -> db -> update("owned_adoptables", array("gender" => 'f'),"aid='{$adopt->aid}' and owner ='{$item->owner}'");
                    
$note "Your adoptable {$adopt->name} is now female.";
            }
            
//Update item quantity...
            
$delitem $item->remove();
        }
        return 
$note;
        } 
__________________

Last edited by Hwona; 08-21-2013 at 04:48 PM.
Reply With Quote