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. :(