Categories > TinyButStrong general >

nodata error?

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Maz
Date: 2005-10-22
Time: 12:51

nodata error?

I have the following:

//------------------------------------------------
// Last five files uploaded by Member
//------------------------------------------------
$query = "    SELECT date, file from ic_bandwidth
            WHERE mbr_id=7
            ORDER BY date LIMIT 5";

$last5uploads = $db->get_results($query, ARRAY_A);

if($db->num_rows == 0)
{
    $last5uploads = '';
}

$TBS->MergeBlock('last5uploads', $last5uploads);
$TBS->Show();

And then this in the template:

                        <table cellspacing="1" cellpadding="5" summary="">
                            <tr>
                                <th colspan="2">Shows the last five files you uploaded to InvisionCube</th>
                            </tr>
                            <tr>
                                <td class="dark shortwidth">
                                    [last5uploads.date;noerr;block=tr]
                                </td>
                                <td class="light longwidth">
                                    [last5uploads.file;noerr]
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2" class="dark shortwidth">
                                    [last5uploads;block=tr;nodata]No records to show at this time
                                </td>
                            </tr>
                        </table>

The error I get is:

<br /><b>TinyButStrong Error</b> (MergeBlock &#91;last5uploads]): The data source Id '' is an unsupported keyword. And the corresponding custom function 'tbsdb__close' is not found.<br />

The array I have created is deliberately void of records as that's what I wanted to test. I just can't figure why this error occurs.
By: Maz
Date: 2005-10-22
Time: 12:58

Re: nodata error?

Solved it. For anyone else stumbling across the same problem, the solution was:

if($db->num_rows == 0)
{
    $last5uploads = array();
}

instead of

if($db->num_rows == 0)
{
    $last5uploads = '';
}