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;
}