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,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,913
  • Total Topics: 21,308
  • Online today: 884
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 513
  • Total: 513

[Block] EQDKP Recent Drops

Started by Inny, May 06, 2009, 11:54:41 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Inny

As per requested this is the code i came up with, only decorative elements left.


$db_host = 'XXXX';
$db_user = 'XXXX';
$db_pass = 'XXXX';
$db_table = 'XXXX';

// edit variables above to your site's requirements

mysql_connect ($db_host, $db_user, $db_pass);
mysql_select_db ($db_table);
     
// Get latest items from each dkp pool
$dkp_tables = array('eqdkp');  // Your prefix may be different of course

$items = array();
print "<table border=0 class=text cellspacing=0 cellpadding=0 color=555652 face=Verdana>";
foreach ($dkp_tables as $table) {
   $result = mysql_query("SELECT item_ctrt_wowitemid, item_name, item_buyer, raid_date
                     FROM eqdkp_items AS i
                     INNER JOIN eqdkp_raids AS r ON i.raid_id=r.raid_id
                     ORDER BY raid_date DESC LIMIT 7") or die(mysql_error());

   while ($row = mysql_fetch_array($result))
   {
      //$row['dkpsite'] = $table;
      //$items[] = $row;
     $time = $row['raid_date'];
     print "<tr><td>Item: </td>
     <td><a href='http://www.wowhead.com/?item=" . $row['item_ctrt_wowitemid'] . "'>" . $row['item_name'] . "</a></td></tr>   
     <tr><td>Buyer: </td>
     <td>" . $row['item_buyer'] ."
     </td></tr>";
   }
}
print "</table>";


You need to have wowhead tooltips in your site it order to give you item tooltips. Installation of them can be found here.

JPDeni

Quoteonly issue is that it gives "Database not selected" error

The way to avoid problems is to put your tables into the same database as SMF. That way you don't have to worry about any database stuff at all and you can just use SMF's db_query function.

Inny

Yeah i dont really like running other things in the SMF database but yeah life would be so much easier :P

I fixed the code a bit, believe it or not i did it on my own!  ^-^

Just need to modify it a bit more to give wowhead tooltips now  :buck2:

Ianedres

I removed the database access information that was in the top of your code for security purposes.

You may wish to look at creating a sub-directory for including a second script that contains the database information; then you use the 'require_once' statement to get the variables into the above script.

Just a bit more protection against prying eyes... ;)

Inny

Quote from: Ianedres on May 06, 2009, 05:30:24 PM
I removed the database access information that was in the top of your code for security purposes.

You may wish to look at creating a sub-directory for including a second script that contains the database information; then you use the 'require_once' statement to get the variables into the above script.

Just a bit more protection against prying eyes... ;)

copy pasting hurts :( Thanks

Inny

Added in the code support for wowhead tooltips. Need some minor improvements on how the table looks which i will do in the following days.

maviel

is it possible to make bb codes work with this?

Inny



Inny

Try:

$db_host = 'XXXX';
$db_user = 'XXXX';
$db_pass = 'XXXX';
$db_table = 'XXXX';

// edit variables above to your site's requirements

mysql_connect ($db_host, $db_user, $db_pass);
mysql_select_db ($db_table);
     
// Get latest items from each dkp pool
$dkp_tables = array('eqdkp');  // Your prefix may be different of course

$items = array();
print "<table border=0 class=text cellspacing=0 cellpadding=0 color=555652 face=Verdana>";
foreach ($dkp_tables as $table) {
   $result = mysql_query("SELECT item_ctrt_wowitemid, item_name, item_buyer, raid_date
                     FROM eqdkp_items AS i
                     INNER JOIN eqdkp_raids AS r ON i.raid_id=r.raid_id
                     ORDER BY raid_date DESC LIMIT 7") or die(mysql_error());

   while ($row = mysql_fetch_array($result))
   {
      //$row['dkpsite'] = $table;
      //$items[] = $row;
     $time = $row['raid_date'];
     print "<tr><td>Item: </td>
     <td>[item]" . $row['item_name'] . "[/item]</td></tr>   
     <tr><td>Buyer: </td>
     <td>" . $row['item_buyer'] ."
     </td></tr>";
   }
}
print "</table>";


Not sure if your script will get the item tags in the php block but it should I think.

This website is proudly hosted on Crocweb Cloud Website Hosting.