vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Call to a member function query_read() on a non-object in (https://vborg.vbsupport.ru/showthread.php?t=235092)

abdicar 02-05-2010 05:22 PM

Call to a member function query_read() on a non-object in
 
Hi there to everybody :)

I'm testing in the widgets to insert our custom php code in vb4.

I have this:

$results = $db->query_read("SELECT *
FROM user LIMIT 0 , 1);

And I got something like this:

Fatal error: Call to a member function query_read() on a non-object in /home/admin/domains/.../packages/vbcms/widget/execphp.php(171) : eval()'d code on line 2

Do you have any suggestion to connect from a widget with direct php exc to check the database?

thank you!

Lynne 02-05-2010 05:33 PM

You really should take a look at some of the widgets already released here to see how they went about this. You need to make a query like so:
PHP Code:

$results vB::$db->query_read("stuff..... 


abdicar 02-05-2010 07:47 PM

Yes, but i tried to search widgets here and i can't found any :(

Paul M 02-05-2010 08:26 PM

Actually you can just do what you would do in any function. Globalise $vbulletin, and use it in all database calls instead of $db ;


PHP Code:

globalise $vbulletin;

$results $vbulletin->db->query_read("stuff..... 



Quote:

Originally Posted by abdicar (Post 1975597)
Yes, but i tried to search widgets here and i can't found any :(

Your not looking very hard, there are plenty.

abdicar 02-05-2010 08:51 PM

Thank you for your reply guys. I just get it. Thank you and have a great weekend.... beer time!


All times are GMT. The time now is 08:14 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00983 seconds
  • Memory Usage 1,719KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete