Put "FavPet" in a Smarty template based sidebar?

Forum
Last Post
Threads / Messages

bisexuowl

x3 furry trash x3
Member
Joined
Sep 22, 2015
Messages
22
Points
0
Age
23
Location
California
Mysidian Dollar
3,169
so i'm designing my own theme and so far it's been really fun! however, i have realized i have no clue how to grab the favpet id from the database to assign it in the class_template.php. i've tried just "$this->assign("favpet",$mysidia->user->profile->favpet)", i've tried "$favpet = mysql_query("SELECT 'favpet' FROM 'aetherwisps_1'.'aw1_users_profile' WHERE 'uid' = '{$uid}'");", and i think i tried one more thing but i don't remember.
 
Well first of all, never use mysql_query. Its been considered a terrible practice being procedural, insecure and outdated. Latest PHP versions already remove mysql_ functions, you should use $mysidia->db for Mysidia Adoptables. Or alternatively, try PDO if you dont want to use $mysidia->db or do not have access to it.
 
at the risk of sounding silly, how do i use $mysidia->db properly? i was new to coding a few months ago and took a break and now i'm totally lost again ;n;
 
thanks for the help! i think i'm on the right track now, i've gotten it to half work and i think i can figure out the rest. :3
 
Note you may not be able to use $mysidia->db directly in a template .tpl file, it is available in any PHP files by calling $mysidia = Registry::get("mysidia"); You may want to fetch all favorite pets data from database, assign them as array or other collection types in smarty template, and then use the collection in smarty template.
 

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,277
Messages
33,118
Members
1,602
Latest member
BerrieMilk
BETA

Latest Threads

Latest Posts

Top