SELECT查询无提示失败,没有产生输出

First of all I need to tell that I'm newbie on PHP/mySQL...

I'm trying to write simple plugins using php. Here is my php function code :

function example() {    
    global $DB;     
    $examplesql = $DB['DB_Database']->query("SELECT tid, added
                                                 FROM table GROUP BY tid
                                                 ORDER BY added DESC LIMIT 5");
    while ($row = $DB['DB_Database']->fetch_assoc($examplesql)) {
        $time = date('Y-m-d H:i:s',$row['added']);  
        $torid = $row['tid'];
    }   
    eval("\$exampletemplate = \""
         . $DB['DB_Template']->LoadTemplate('exampletemplate')
         . "\";"); 
    return $example;
}

so when I create a template named as exampletemplate and insert into that template this;

<table width="200" border="1">
  <tr>
    <td>$time</td>
    <td>$torid;</td>
  </tr>
</table>

it must show list of last 5 tid sorted by added but all I get is a white page. No database error, nothing. Just a white page.

Can somebody tell me what am I doing wrong?

A white page means you have error_reporting turned off. PHP wants to tell you what your error is but you won't let it. Put the following line of code at the top of your file, or in your config file, to enable error reporting:

error_reporting(E_ALL);

Also make sure display_errors is ON in your php.ini file.

1st: Do you set or declare the variables $time and $torid? Is there an assurance that it is set inside the while-loop? Where do $TSUE came/set from?

2nd: Use echo $time; in html under <?php ?> like:

<table width="200" border="1">
  <tr>
    <td><?php echo $time; ?></td>
    <td><?php echo $torid; ?></td>
  </tr>
</table>

3rd: Where or how you call your function?