16
Sorry, I was stuck for a while as my server crashed. Now that it's back in order, I set about trying to figure this out.
I hate to do this, but I'm really REALLY stumped. I'm going to post the two files as they are right now. Then I'll post the error messages I get:
First: ./modules/tunetracker/blocks/tt_blocks.php
<?php /***************************************************************************** Tune Tracker Database Written For: SceneSpot.org By: D. Travis "Coplan" North ******************************************************************************/ include_once('../../../mainfile.php'); include_once('../system.php'); function b_tunetracker_current_tunes() { global $xoopsDB, $tt_sinfo, $tt_users, $tt_songs; // I get errors if I remove these lines, as if they aren't defined. $tt_users = $xoopsDB->prefix("users"); $tt_sinfo = $xoopsDB->prefix("tt_sinfo"); $tt_songs = $xoopsDB->prefix("tt_songs"); $block = array(); $sth = $xoopsDB->query('SELECT *, DATE_FORMAT(s_date, "%b %d %Y") as f_date FROM '.$tt_sinfo.' ORDER BY s_date DESC LIMIT 8') or die (mysql_error()); $cnt = 0; while ($row = $xoopsDB->fetchArray($sth)) { $block['tunes'][$cnt]['url'] = XOOPS_URL.'/modules/tunetracker/viewsong.php?id='.$row[sinfo_id]; $block['tunes'][$cnt]['s_name'] = $row[s_name]; $block['tunes'][$cnt]['date'] = $row[f_date]; $a_sth= $xoopsDB->query('SELECT uname FROM '.$tt_songs.' LEFT JOIN ' .$tt_users.' ON '.$tt_songs.'.user_id='.$tt_users .'.uid WHERE sinfo_id="'.$row[sinfo_id] .'" ORDER BY uname') or die (mysql_error()); $ac = 0; while ($arow = $xoopsDB->fetchArray($a_sth)) { if ($ac >= 1) { $block['tunes'][$cnt]['artist'] .= ', '; } $block['tunes'][$cnt]['artist'] .= $arow[uname]; $ac++; } $cnt++; } return $block; } ?>
Next: ./modules/tunetracker/system.php
<?php /***************************************************************************** * Tune Tracker Database * Written Exclusively For: SceneSpot.org * By: D. Travis "Coplan" North * * Configuration files needed by a couple of different scripts ******************************************************************************/ // Get module ID (used for admin checks, etc) $mid = $xoopsModule->mid(); // Beta Message -- uncomment for beta $beta = <<<END_QUOTE <b><em> Please note that this is a beta release of Tune Tracker. This is for testing only. Any entry added may or may not be saved for future use on the official SceneSpot website. </em></b> END_QUOTE; // Set the Tables Needed: $tt_users = $xoopsDB->prefix("users"); $tt_guests = $xoopsDB->prefix("tt_guests"); $tt_sinfo = $xoopsDB->prefix("tt_sinfo"); $tt_songs = $xoopsDB->prefix("tt_songs"); $tt_genre = $xoopsDB->prefix("tt_genre"); $tt_sgenres = $xoopsDB->prefix("tt_sgenres"); $tt_type = $xoopsDB->prefix("tt_type"); $tt_files = $xoopsDB->prefix("tt_files"); $tt_options = $xoopsDB->prefix("tt_options"); $tt_votes = $xoopsDB->prefix("tt_votes"); $tt_dlcnt = $xoopsDB->prefix("tt_dlcnt"); ?>
As you can see, the system.php file defines all those table names. That is the real reason why I want to call them into my blocks script. However, if I comment out the lines indicated in tt_blocks.php (3 lines, starting $tt_...), I get error messages from mySQL as if the table names weren't defined.
If I run 'php tt_blocks.php' at the command prompt, I get no errors.
Does anyone have any thoughts as to what the problem might be? I really want to get this figured out.