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 03-08-2016, 11:51 PM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 127,196
Kyttias is on a distinguished road
Default

No, partially because editting the adopts_pounds table won't help you, lol?

The babies are stored as an psuedo-array with the parents. You have to take the adopt, identify its parents, extract the arrays from the database for each parent, explode these arrays from a strings into an an actual arrays PHP can work with, carefully remove the id of the pet you're deleting, implode it back into a string, and reinsert it into the database.

Confirmed working (edit: Updated Mar 9 @ 2:21AM EST!):
PHP Code:
/* . . . REMOVE PET FROM FATHER'S LIST OF CHILDREN . . . */
# Find the father.
$father = new OwnedAdoptable($this->adopt->father); 
# Open the array of the father's kids.
$father_kids explode(","$father->offsprings); 
# Remove specific adoptable from the list of kids.
foreach($father_kids as $i => $kid){
  if(
$kid == $this->adopt->getAdoptID()){
    unset(
$father_kids[$i]);
  }
}
# Close the array of the father's kids.
$father_kids implode(",",$father_kids); 
# Put the updated list of kids back in the database.
$mysidia->db->update("owned_adoptables", array("offsprings" => $father_kids), "aid = '{$father->aid}'");


/* . . . REMOVE PET FROM MOTHER'S LIST OF CHILDREN . . . */
# Find the mother.
$mother = new OwnedAdoptable($this->adopt->mother); 
# Open the array of the mother's kids.
$mother_kids explode(","$mother->offsprings); 
# Remove specific adoptable from the list of kids.
foreach($mother_kids as $i => $kid){
  if(
$kid == $this->adopt->getAdoptID()){
    unset(
$mother_kids[$i]);
  }
}
# Close the array of the mother's kids.
$mother_kids implode(",",$mother_kids); 
# Put the updated list of kids back in the database.
$mysidia->db->update("owned_adoptables", array("offsprings" => $mother_kids), "aid = '{$mother->aid}'"); 
Snuggle the above code directly up to (and probably right before) where the pet itself is deleted.
__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it.

Last edited by Kyttias; 03-09-2016 at 01:32 AM.
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:27 AM.

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