View Single Post
  #12  
Old 03-09-2016, 06:07 PM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 334,036
Hall of Famer is on a distinguished road
Default

Well when debugging your site, I find that it has a very serious glitch resulted from this Active Pet Module. For a newly registered user, they do not own any adoptable yet, and therefore do not have favorite pet. However, the script assumes that this new user has favorite pet, and try to fetch the adoptable ID 0 instead(favorite pet ID defaults to 0 if it does not exist). This leads to an uncaught exception 'adoptable ID does not exist', and will prevent any newly registered users from browsing your site.

To fix this, you need to take care of the scenario in which the user has no favorite pet(ID = 0). In this case, you will either just not fetch adoptable at all, or catch exception using a try...catch block. The choice is up to you.


Edit: Strangely the solution Kyttias offered seems to have taken care of nonexistent favorite pet ID already, but when I dont have a favorite pet I still receive errors. Did you copy/paste her code exactly? Or something else is wrong?
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote