Having a little problem, trying to make my code a little more vbulletin oriented so I want to do queries though the $db class. Code is a no go:
includes/class_test.php
PHP Code:
<?php
if (!isset($GLOBALS['vbulletin']->db))
{
exit;
}
class test {
var $registry = null;
function letest(){
global $vbulletin;
$result = $this->registry->db->query_first("SELECT * FROM table WHERE id = '1'");
$o .= $result['name'];
$o .= ' - And the id is: ';
$o .= $result['id'];
return $o;
}
}
?>
/test.php
PHP Code:
require_once('./global.php');
require_once('./includes/class_test.php');
$t = new test;
echo $t->letest();
error:
Code:
Fatal error: Call to a member function query_first() on a non-object in /var/www/gibby/data/www/otakuni.com/includes/class_test.php on line 14
vb API and docs are worse than useless.
--------------- Added [DATE]1348364530[/DATE] at [TIME]1348364530[/TIME] ---------------
Figured it out in case any other poor soul wants mercy from the absolutely useless bullshit they call documentation. Thanks for changing it around every 2 weeks btw.
PHP Code:
<?php
if (!isset($GLOBALS['vbulletin']->db))
{
exit;
}
class test {
function letest(){
global $vbulletin;
$result = array();
$result = $vbulletin->db->query_first("SELECT * FROM table ");
$o .= print_r($result);
return $o;
}
}
?>