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
include('./global.php');
$events = $db->query_read("SELECT UNIX_TIMESTAMP() AS calendarid, dateline_from, title, lv_vb_eventforums_threadid, customfields
FROM event
WHERE dateline_from > UNIX_TIMESTAMP()
ORDER BY dateline_from");
That didn't work (global.php errors), so let's try copying from some other cron jobs:
PHP Code:
?php
require_once(DIR . '/includes/functions_calendar.php');
$timenow = TIMENOW;
/$events = $vbulletin->$db->query_read("
SELECT event.calendarid, dateline_from, event.title, lv_vb_eventforums_threadid, customfields,
FROM " . TABLE_PREFIX . "event AS event
WHERE dateline_from >= $timenow AND event.calendarid = 1
ORDER BY dateline_from");
Nope, no such luck!
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!!!!!