vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Some queries and plugin help (https://vborg.vbsupport.ru/showthread.php?t=223949)

rockinaway 09-25-2009 06:26 PM

Some queries and plugin help
 
I am making a plugin and just wondered, what should I use to call data from the database? i.e. what should replace mysql_query() and mysql_result()

Thanks

Lynne 09-25-2009 06:58 PM

This page from the manual should help - SQL Query Syntax

rockinaway 09-25-2009 07:02 PM

Okay a few questions. I have been using similar things but I get this error:

Quote:

Fatal error: Call to a member function on a non-object in /home/.endora/othersites/etcworld.co.uk/test/includes/class_postbit.php(265) : eval()'d code on line 5
Then what is the difference between query_read and query_first?

And how can I do mysql_result?

Lynne 09-25-2009 07:23 PM

query_first means you don't have to do a fetch_array after doing the query - it is for when you only expect one row from your query.

Take a look at the vbulletin code in your files. There are lots and lots of examples in there.

Your error is most likely from a plugin. Look at line 265 in class_postbit. My guess is it is a hook and thus you have an error in a plugin that uses that hook location.

Adrian Schneider 09-25-2009 07:29 PM

Inside vBulletin classes, you must access the vBulletin registry object (which contains the database object) via
PHP Code:

$this->registry 

because $vbulletin and $db are not in scope. Your code would be something like this,
PHP Code:

$result $this->registry->db->query_read("Your Query"); 


rockinaway 09-25-2009 07:36 PM

Perfect :)

And, I seem to be using $vbulletin ..... instead of $this :)


All times are GMT. The time now is 02:50 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
  • Page Generation 0.01056 seconds
  • Memory Usage 1,720KB
  • 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
  • (6)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