Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Questions and Supports

Notices

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #18  
Old 03-16-2016, 02:53 PM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 135,914
Kyttias is on a distinguished road
Default

The best thing to do will be just to make a try/catch as we did before, actually, with the children. Telling you where to make edits is a little harder, so, from the thread where the family tree was made, post number four, the first bit of code. That. Where-ever you put that, no matter how you designed it within, it'll be easiest just to put this above it, so we have both:

PHP Code:
if ($adopt->mother != NULL){ try { $mother = new OwnedAdoptable($adopt->mother); } catch (AdoptNotfoundException $anfe){ $adopt->mother NULL; } }
if (
$adopt->father != NULL){ try { $father = new OwnedAdoptable($adopt->father); } catch (AdoptNotfoundException $anfe){ $adopt->father NULL; } }
if (
$adopt->grandmotherA != NULL){ try { $grandmotherA = new OwnedAdoptable($adopt->grandmotherA); } catch (AdoptNotfoundException $anfe){ $adopt->grandmotherA NULL; } }
if (
$adopt->grandmotherB != NULL){ try { $grandmotherB = new OwnedAdoptable($adopt->grandmotherB); } catch (AdoptNotfoundException $anfe){ $adopt->grandmotherB NULL; } }
if (
$adopt->grandfatherA != NULL){ try { $grandfatherA = new OwnedAdoptable($adopt->grandfatherA); } catch (AdoptNotfoundException $anfe){ $adopt->grandfatherA NULL; } }
if (
$adopt->grandfatherB != NULL){ try { $grandfatherB = new OwnedAdoptable($adopt->grandfatherB); } catch (AdoptNotfoundException $anfe){ $adopt->grandfatherB NULL; } } 
And you may not need the grandparent bits, of course.

So why do we need this code first?

Basically, the code from the post I referred to is checking whether or not the current adoptable has a parent held in its database column (it's checking for NULL, so, so long as something there, it should try to render something). Well, we're backing up a step. First we're checking if the field is not NULL - okay, something is there? Okay, but does that pet actually exist? We check that. And if doesn't exist? We inform the code it is NULL, therefore stopping the original code.

If something about this goes strangely, go ahead and send me the file via PM.
__________________
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.
Reply With Quote
 


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 09:37 AM.

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