Categories > TinyButStrong general >

TBSSql Error??

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Trent
Date: 2008-07-01
Time: 05:51

TBSSql Error??

I'm writing a new messaging system for one of my sites and I'm having some problems with TBSSql.  I call the below function to retrieve all the messages in the database that are active for the current user.  In the function, it calls another function called "replace()" to parse any BBCode included in the message and returns and array of the messages to use with my inbox template (or at least it's supposed to).  And there in lies the problem.  :(
function get_inbox($cid){
global $Db;
$sql = "SELECT i.*,u.* FROM pm i LEFT JOIN characters u ON (i.sender=u.cid) where i.cid = $cid ORDER BY i.pm_id DESC LIMIT 15";           
$inbox_query = $Db->GetRows($sql);

    foreach($inbox_query as $key=>$value)
            {
                $inbox_msg->$key = $value;
            }
            $inbox_msg->message = replace($inbox_msg->message);

            return $inbox_msg;
}

I get the data from my mail.php page and pass it onto TBS...

$inbox = get_inbox($cid);
$inbox = array($inbox);
...
...
$TBS->MergeBlock('inbox',$inbox);

When I try and load the page I get the following error:

TinyButStrong Error when merging block [inbox] : Data source Id 'stdClass' is unsupported because function 'tbsdb_stdClass_open' is not found.

I run a similar function that only retrieves a single message using basically the same function and system above with minor changes to make it call a single record only, and it works great.  But when I try and list the entire inbox using the function above, it pops up the error.  I'm sure this is a simply SQL/PHP error instead of a TBS specific error, but I just can't seem to find what I'm doing wrong.  :(
By: tOnGAs
Date: 2008-07-01
Time: 10:45

Re: TBSSql Error??

When mergin an array, I always use :

$TBS->MergeBlock('inbox', 'array', $inbox);

Hope this helps...
By: Skrol29
Date: 2008-07-02
Time: 19:18

Re: TBSSql Error??

Hi Trent,

It it probaly related to the HTML for block 'inbox'.
Can you give more info about it ?

By: Trent
Date: 2008-07-03
Time: 00:07

Re: TBSSql Error??

Here's the inbox template:

<div id="message">
      <table width="100%" style="border: 1px solid #010101;" cellspacing="0" cellpadding="0">
        <tr>
          <td class="menu_cell">[inbox;block=div;headergrp=#][inbox.subject;ope=max:100]</td>
        </tr>
        <tr>
          <td align="center">Sender: <a href="user.php?profile=[inbox.cname]" title="View [inbox.cname]'s Profile">[inbox.cname]</a>    &nbsp; &curren;&nbsp; Received: [inbox.timestamp;frm='d mmm yyyy, r:nn AMPM';]  </td>
        </tr>
        <tr>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td><p>[inbox.message;block=p;htmlconv=no;protect=no;ondata=f_replace]</p>
            <BR />
          <p align="right"> &curren; <a href="[var..script_name]?act=reply&amp;msg_id=[inbox.pm_id]">Reply</a> &curren; Delete
          <input type="checkbox" name="delsel[]" value="[inbox.pm_id]"> &curren; </td>
          </tr>
      </table> 
      <BR>
</div>
<div id="no_message">[inbox;block=div;nodata]No Messages.</b></div>