The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
PHP cron to access events and user data
I am trying to access the event and user tables through a PHP cron job and being a complete newbie, I am having issues!!!
I downloaded the tables as CSV files to get their field names and layout. I then used the following to access the data on my vb3.5.5 forum: PHP Code:
PHP Code:
Fatal error: Call to a member function on a non-object in .../includes/cron/events.php on line 16 Line 16 is the SELECT statement. OK, I know I'm clueless but can you help me get this working? When do you use $vbulletin->$db->query_read versus $db->query_read? Why do the fields names change (event.title versus title)? How do you read data from a table? I have spent DAYS going through all the keyword searches I can think of and nothing conclusive. When I get this thing working, I am going to post an "Idiots Guide to Reading vBulletin Databases". Thnaks in advance for any help you can offer me!!!!! |
#2
|
|||
|
|||
It's $vbulletin->db->query_read (there's no $ on the db part)
|
#3
|
|||
|
|||
Thanks for the help...don't know how I missed that one :-(
Now I get the following: Quote:
The CSV file shows the field names as calendarid, dateline_from, title, lv_vb_eventforums_threadid and customfields. But changing the field names doesn't seem to help. Thoughts? Also, how do you know which field names to use? |
#4
|
|||
|
|||
I re-read the first post and it said you're trying to access the event and user tables. Which fields from which tables are you trying to access?
|
#5
|
|||
|
|||
Quote:
Quote:
|
#6
|
|||
|
|||
No idea, it looks fine and works in my phpmyadmin.
The reason I asked was because I'm not certain over the way the sql has been put together, which means I can't figure out why it's erroring. I know it can be picky about the smallest of details, so I was wondering what the entire query was to do so I could construct one for you. |
#7
|
|||
|
|||
Quote:
Thanks! |
#8
|
||||
|
||||
First of all, you are calling the table AS event.. Then you are only prefixing a few columns with event.. Get rid of the whole AS event bit as well and any prefixes used. That is not needed with a single table call and confuses things.
The error message is most likely refering to your last column call. Get rid of the final comma before FROM. PHP Code:
|
#9
|
|||
|
|||
I noticed the unnecessary 'event's, I was gonna tackle them in any rewrite.
And yes, the error is likely from that comma. It's always the tiny symbols you don't notice that cause the most trouble eh. In case it's not clear, this is the tidy rewrite of that code: Code:
SELECT calendarid, dateline_from, title, lv_vb_eventforums_threadid, customfields FROM event WHERE dateline_from >= 1156455695 AND calendarid = 1 ORDER BY dateline_from |
#10
|
|||
|
|||
You guys rock! Thanks, the fog is lifting.
Quote:
Thanks again! |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|