| The Arcive of vBulletin Modifications Site. | |
| 
			 
			#1  
			
			
			
			
			
		 | |||
| 
 | |||
|  Call to a member function query_read() on a non-object 
			
			I seem to run into this problem a lot and it's always a pain to fix. This is being used to make a bbcode with this mod: https://vborg.vbsupport.ru/showthrea...44#post2346244 . PHP Code: 
			I added the require_once on global to try and fix it but it didn't work. Every time I have this problem I always find this as well: https://vborg.vbsupport.ru/showthread.php?t=235092 but that never fixed it either. Changing the query to vB::$db->query_read(" simply changes the error saying that the class vB isn't defined. also using $vbulletin->db->query_read doesn't seem to solve the problem either. | 
| 
			 
			#2  
			
			
			
			
			
		 | |||
| 
 | |||
|   
			
			Below this code Code: require_once('./global.php');Code: global $db; | 
| 
			 
			#3  
			
			
			
			
			
		 | ||||
| 
 | ||||
|   
			
			I prefer to have $vbulletin global and use $vbulletin->db.
		 | 
| 
			 
			#4  
			
			
			
			
			
		 | |||
| 
 | |||
|   Quote: 
 Code: or you change $db-> with $vbulletin->db Quote: 
 Code: $db->fetch_array | 
| 
			 
			#5  
			
			
			
			
			
		 | |||
| 
 | |||
|   
			
			Thanks guys. --------------- Added [DATE]1341819639[/DATE] at [TIME]1341819639[/TIME] --------------- Nope, globalizing $db works however even replacing both lines with $vbulletin->db the error occurs. | 
| 
			 
			#6  
			
			
			
			
			
		 | |||
| 
 | |||
|   
			
			Are you using this within a hook? If so, you should remove that require because global.php has already been included.
		 | 
| 
			 
			#7  
			
			
			
			
			
		 | |||
| 
 | |||
|   Quote: 
 Code: $GLOBALS['vbulletin']->db | 
|  | 
| 
 | 
 | 
| X vBulletin 3.8.12 by vBS Debug Information | |
|---|---|
| 
 | |
|  More Information | |
| Template Usage: 
 Phrase Groups Available: 
 | Included Files: 
 Hooks Called: 
 |