![]() |
Use Owned_Adoptable to call Adoptable?
For my site, I'm tying a lot of traits to species (prefix_adoptable) rather than to individual pets (prefix_owned_adoptable). Problem is, for things like profiles and items, I need to be able to get those values for the pet's species, using the pet's information. How do I call the other table?
|
To call data from the adoptables table (or any table), you would just use a line of code likes this:
HTML Code:
$mysidia->db->select("adoptable", array("Column"), "Row = '$somevalue'")->fetchColumn(); If you're trying to define a variable or something, it would look like this: HTML Code:
$trait = $mysidia->db->select("adoptable", array("Column"), "Row = '$somevalue'")->fetchColumn(); |
Quote:
|
I can't understand you're question too well, so I probably gave you the wrong code just now, sorry ^^;
Are you trying to get the species of a user's pet and use that to fetch the traits? |
Taking over for aqua here, since I'm the one who does most of the code work for our site. And yes, that's exactly what we were trying to do.
|
Oh! Okay, then you would first get the species of the user's adopt with this:
Quote:
Quote:
Quote:
|
Alright, and I'm going to need to use db referrals instead of getWhatever, if I need to use these in an item function, yeah?
|
To get a pet's info from the database, you would need to get the ID of the pet somehow. In the case of items, items get the ID of a pet like this:
Quote:
I haven't tried, but I'm assuming $adopt->getType(); or $adopt->getType would still work. This is because items already call the pet that it's about to be used on so you don't have to use the whole database call to get it. From there, the code should still work the same. |
Unfortunately, the getFoo() functions don't seem to work in that file - I had it error out frequently when I tried, complaining of invalid something. The alternative seems to be manually calling it, but I think I can get it working. I'll swing back and let you know if it does.
|
All times are GMT -5. The time now is 01:38 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.