TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,966
  • Latest: safir45
Stats
  • Total Posts: 195,989
  • Total Topics: 21,322
  • Online today: 742
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 480
  • Total: 480

Upcoming PHPRaid Events

Started by sloanja, March 21, 2007, 05:25:34 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

sloanja

Following is the code I'm using to display upcoming raids from PHPRaid. 

PHPRaid must be using the same database as SMF/TP. 


//configuration
$PHPRaidPrefix  = "phpraid_";
$PHPRaidLink = "http://www.YOURWEBSITE.com/phpraid";

echo '<center><font size="-2">';

$sql1 = "SELECT raid_id, location, description, old, invite_time FROM {$PHPRaidPrefix}raids  WHERE old=0 order by start_time";

echo '<center><br><a href="' . $PHPRaidLink . '"><b>Upcoming Events</b></a><br><br>';

$request = db_query($sql1, __FILE__, __LINE__);
While ($row = mysql_fetch_assoc($request)){
$raid_loc = $row[location];
$raid_descr = $row[description];
$raiddate =  date("F j, Y, g:i a",$row[invite_time]);
$raid_id =  $row[raid_id];

echo '<a href='.$PHPRaidLink.'/view.php?mode=view&raid_id='.$raid_id.' target="_blank">'.$raid_loc.'</a> <br><b>'.$raiddate.'</b> <br><i>'.$raid_descr.'</i><br><br>';

};

echo '</font></center>';



MarioG

#1
if u want to fetch data from another db u can easly add db name prefix:
$sql1 = "SELECT raid_id, location, description, old, invite_time FROM $dbname.{$PHPRaidPrefix}raidsÃ,  WHERE old=0 order by start_time";

Anyway, I have some probs about fetched date, in some raids I get the wrong hour... I'll find out what's wrong and i'll post more info asap

sloanja

I had to adjust PHPRaid to use a different time zone, then modified the runs to be the correct time again.

Future runs won't have to be modified to be the right time, since they'll show up as the right time.  My host is running PHP 4.x, so the timezone isn't easily settable like it is in 5.x.

Phinhead54

#3
This block completely crashes my TP/SMF index page now.  Not sure what changed, it had been running well for a few months.  The best I can tell is it begins to cause a premature end to the script headers in index.php.

Phinhead54

Ok, for what it's worth if this is happening to anyone else, I finally sat down and figured out the issue.

$raiddate =  date("F j, Y, g:i a",$row[invite_time]); was causing catastropic failure of the website ... I had to change the code to use 2 lines of code
  $int_date = $row[invite_time];
  $raiddate =  date("D, F j, Y, g:i a",$int_date);
to keep it from erroring.  I believe we are using php 4.4.4, but I really know next to nothing about php, I just kind of figured out what was wrong the long way.

Starbearer

I integrated this code into my website and I wanted to thank you for that. Really cool  :up:.

Since I am not such a coding-master, I'd like to ask if there is any way to limit the number of the shown raids in the block. E.g we have 10 raids scheduled in PHPRaid, but the box should only show the first 3. Thx in advance.

IchBin

Change this line:
$sql1 = "SELECT raid_id, location, description, old, invite_time FROM {$PHPRaidPrefix}raids  WHERE old=0 order by start_time";

To this:
$sql1 = "SELECT raid_id, location, description, old, invite_time FROM {$PHPRaidPrefix}raids  WHERE old=0 order by start_time LIMIT 3";

This website is proudly hosted on Crocweb Cloud Website Hosting.