With my very limited PHP programming skills (don't laugh!) I have somehow managed to pull data from the forum database and make my own custom islands showing full postings:

www.fabulaemarrii.com/guildnews2.php

...using this code:

PHP Code

<?php
  // Open and select database
  $link = mysql_connect('topsecretserver','topsecretdatabasename','topsecretpassword');
  if (!$link)
	{
	die('Cannot connect to server: '.mysql_error());
	}

  $db = mysql_select_db('topsecretdatabase',$link);
  if (!$db)
	{
	 die('Cannot select database: '. mysql_error());
	}

  // Find out post id's
	  $query = "SELECT * FROM ubbt_TOPICS where FORUM_ID=18 ORDER BY POST_ID DESC";
	  $result = mysql_query($query);
	  if (!$result)
		{
		die('Cannot read from database: '.mysql_error());
		}
	  $num_results = mysql_num_rows($result);
	  echo '<i>Found '.$num_results.' results. </i>';

  echo '</tr><tr bgcolor="#555555"><td>';

  // Build table

	  for ($i=0; $i <$num_results; $i++)
		{
		$rowid = mysql_fetch_array($result);
		$postid=$rowid['POST_ID'];

		$queryposting = "SELECT * FROM ubbt_POSTS where POST_ID=".$postid."";
		$resultposting = mysql_query($queryposting);
		if (!$result)
		  {
		  die('Cannot read from database: '.mysql_error());
		  }
		$rowposting = mysql_fetch_array($resultposting);
		$subject=$rowposting['POST_SUBJECT'];
		$time=$rowposting['POST_POSTED_TIME'];
		$body=$rowposting['POST_BODY'];
		$userid=$rowposting['USER_ID'];

		if ($userid=='211')
		  {
		  $username="Catkin";
		  }
		elseif ($userid=='2')
		  {
		  $username="Yomarbalthasar";
		  }
		else
		  {
		  $username="We have no idea, really";
		  }

	  echo '<b><font color="white">'.$time.': '.$subject.'</b></font><br>';
	  echo '</td></tr><tr bgcolor="#CCCCCC"><td>'.$body.'<br><i>Posted by '.$username.'</i>';
	  echo '</td></tr><tr bgcolor="#555555"><td>';
	  }
?>


So far so good. Now the last thing I need to do to get this working is convert the time of the posting. I can pull it from the database, but I get some illegible number. How do I convert this number to a more legible format, preferably YYYYMMDD HHMM (24-hour format)?

There's probably one command for this, but to find out what works, I need to know in what format this data is stored in the first place.

Last edited by Yomar; 10/10/2006 3:32 AM.