|  | 
| Home Community Mys-Script Creative Off-Topic | 
| 
 | |||||||
|  | 
|  | Thread Tools | Display Modes | 
| 
			 
			#1  
			
			
			
			
			
		 | |||
| 
 | |||
|  Put "FavPet" in a Smarty template based sidebar? 
			
			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.
		 | 
| 
			 
			#2  
			
			
			
			
			
		 | ||||
| 
 | ||||
|   
			
			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.
		 
				__________________  Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site. | 
| 
			 
			#3  
			
			
			
			
			
		 | |||
| 
 | |||
|   
			
			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;
		 | 
| 
			 
			#4  
			
			
			
			
			
		 | ||||
| 
 | ||||
|   
			
			This guide has a section on how to use it: https://docs.google.com/document/d/1...=h.7kcho2wxopx It's the part that says "database sql statements" 
				__________________ | 
| 
			 
			#5  
			
			
			
			
			
		 | |||
| 
 | |||
|   
			
			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
		 | 
| 
			 
			#6  
			
			
			
			
			
		 | ||||
| 
 | ||||
|   
			
			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.
		 
				__________________  Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site. | 
|  | 
| Tags | 
| mysidia 1.3.4, sidebar, smarty template | 
| Thread Tools | |
| Display Modes | |
| 
 | 
 | 
| What's New? | What's Hot? | What's Popular? |