The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
![]()
I'm trying to run db queries at the hook postbit_display_start, but for some reason it doesn't seem to work...
When I try this line: Code:
$foobar = $db->query_read("SELECT username FROM " . TABLE_PREFIX . "user WHERE userid = 1"); Ideas? EDIT: Nevermind, it seems it works when I use the "showthread_postbit_create" hook instead. Now I need to figure out why I get "Resource id #x" instead of the data I'm looking for... *sigh* |
#2
|
|||
|
|||
![]()
Change your function to query_first then query_read.
|
#3
|
|||
|
|||
![]()
In the postbit_* hooks you will most likely need to use the $this->registry->db variable or the $vbulletin->db variable as those hooks are executed within a class, if I remember correctly.
|
#4
|
||||
|
||||
![]() Quote:
![]() ![]() Umm... why? Unless I'm mistaken query_first reads only the first line whereas query_read reads ALL lines (including the first). Anyways, I solved the resource id thingy with fetch_array. |
#5
|
|||
|
|||
![]()
Well query_read only does like mysql_query but query_first does mysql_query and fetch_array both and returns the array. Plus you are only pulling out one row with that query.
|
#6
|
||||
|
||||
![]() Quote:
![]() |
#7
|
|||
|
|||
![]()
To get more then 1 row, you will need to do your query_read() followed by a fetch_array() in a loop.
|
#8
|
||||
|
||||
![]() Quote:
Quote:
![]() |
#9
|
||||
|
||||
![]() Quote:
turns out the syntax I was after in the original hook was Code:
$stories = $this->registry->db->query_first |
#10
|
||||
|
||||
![]() Quote:
Code:
$foo = $this->registry->db->query_read('SQL STRING'); while ($bar = $this->registry->db->fetch_array($foo)) { /* Do stuff.. */ } $this->registry->db->free_result($foo); If you're not already doing that, you might want to ssh to the server (if you have that possibility) and tail the error log to receive real-time error reporting. In a command shell (cmd/terminal): Code:
ssh example.com -l root Code:
tail -f /var/log/httpd/error_log |
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|