The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Option Data From Table
Hello, i writeing a new addon and i have a problem.
i try to load data from a ta table for an option but i cannot make it !!!! Option Code Code:
select:eval require_once(DIR . '/includes/functions_colors.php'); $options = fetch_colors_options_array(); functions_colors.php Code:
<?php error_reporting(E_ALL & ~E_NOTICE); // ###################### Fetch Colors as Options ####################### // Return Colors Options Array function fetch_colors_options_array() { global $vbulletin; $out = array(); // fetch Colors $getcolors = $db->query_read(" SELECT colorid, colorname FROM `" . TABLE_PREFIX . "colors` "); echo 'After Get'; while ($colorrow = $db->fetch_array($getcolors)) { $out["$colorrow[colorid]"] = "$colorrow[colorname]"; } return $out; } ?> Error : Fatal error: Call to a member function on a non-object in /......./......./......./......./forum/includes/functions_colors.php on line 14 |
#2
|
||||
|
||||
Did you include global.php or init.php in your main file? If not, $db->query_read is not valid since it is a vbulletin thing.
|
#3
|
||||
|
||||
no i don't include,
need to include global.php or init.php to functions_colors.php or to plugin i call function ??? |
#4
|
||||
|
||||
Well, or you need to use standard php language to access the database.
|
#5
|
||||
|
||||
Where to put global.php and(or) init.php ??
|
#6
|
||||
|
||||
Well, you need to include it before you make any database calls. So, in either file I would think is fine. Depends on if you will need it again or not.
|
#7
|
||||
|
||||
Quote:
i try and if i have any more problem i write it --------------- Added [DATE]1253218729[/DATE] at [TIME]1253218729[/TIME] --------------- i put require_once('./global.php'); at option code and now the option code are select:eval require_once('./global.php'); require_once(DIR . '/includes/functions_colors.php'); $options = fetch_colors_options_array(); but now the error are : Fatal error: Call to a member function on a non-object in /......./......./......./......./forum/global.php on line 242 |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|