![]() |
Running a query from plugin ? using default function ?
Is it nessesary to assign a function to simply read some data from db..
Want a plugin to read Tablename colum1 |colum2|colum3 ------------------------------ data1 | data2 | data 3 and so on.. well you know a table.. But using a query as i would when writing a .php file for vbulletin dont work so well with plugins.. :( normal : Code:
$linkstat=$db->query_first("SELECT * FROM " . TABLE_PREFIX . "Tablename WHERE Colum1='1'"); Fatal error: Call to a member function query_first() on a non-object in C:\xampp\xampp\htdocs\emod\includes\class_bootstra p.php(392) : eval()'d code on line 63 Which i just suppect is becourse the query_first should be something else . but what. tryed looking at other plugins both from vb and from others just cant figure them out.. help please. |
It's the $db causing the issue. I had the same problem. $db doesn't seem to be defined any more.
$vbulletin->db->query_first() That should work. Though the quickest change to make it work would just be to add $db = $vbulletin->db; at the start of the plugin. |
You can also use vB::$vbulletin->db->
They wrote in an blogcomment that $vbulletin->db also will not work, after they finish all the refactoring |
how about that...
Lol well i can get $vbulletin->db->query_first working but vB::$vbulletin.... dont.. i belive its missing something as in vB_?????::$vbulletin ie : vB_Template::create |
Which hook are you using?
|
hook to "process_templates_complete"
any experience using ? While ($row = $vbulletin->db->fetch_array($data)) { worried about that ->db-> |
It's working fine for me.
PHP Code:
|
Also concerning your worry about using ->db-> why not do $db = $vbulletin->db; at the start of the plugin? May not be the neatest solution but it would work. And then you can use $db as you used to.
|
All times are GMT. The time now is 10:24 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|