Categories > TinyButStrong general >

Problem with data in a block

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

Problem with data in a block

For some reason I think that I'm missing something somewhere in my HTML for my 'inbox.html' file.  Every message has an [inbox.status] value pulled from the database, but for some reason, all of the messages keep returning a status of '0' when they should have mixed values like 0,1,1,0,0, etc...  This value is pulled from the database and is correct for each row, but I think I've left something out in my block syntax because each value is returned as '0'.

          <table border="0" width="100%" cellpadding="0" cellspacing="0">
            <tr>
           
              <td width="20%" class="menu_cell"><b>Sender</b></td>
              <td width="50%" class="menu_cell"><b>Subject</b></td>
              <td width="30%" class="menu_cell"><b>Received</b></td>
            </tr>
            <tr class="row_1">
              <td><a href="user.php?profile=[inbox.cname]">[inbox.cname]</a></td>
              <td style="padding-left: 4px;"><div align="left"><a href="[var..script_name]?act=view&amp;msg_id=[inbox.pm_id]">[inbox.subject;ope=max:100]</a>[inbox.status]</div></td>
              <td>[inbox.timestamp;frm='d mmm yyyy, r:nn AMPM']&nbsp;&nbsp;
                <input type="checkbox" name="delsel[]" value="[inbox.pm_id;block=tr]"></td>
            </tr>
            <tr class="row_2">
              <td><a href="user.php?profile=[inbox.cname]">[inbox.cname]</a></td>
              <td style="padding-left: 4px;"><div align="left"><a href="[var..script_name]?act=view&amp;msg_id=[inbox.pm_id]">[inbox.subject;ope=max:100]</a>[inbox.status]</div></td>
              <td>[inbox.timestamp;frm='d mmm yyyy, r:nn AMPM']&nbsp;&nbsp;
                <input type="checkbox" name="delsel[]" value="[inbox.pm_id;block=tr]"></td>
            </tr>
            <tr>
              <td colspan="3" align="center"><b>[inbox;block=tr;nodata]No Messages.</b></td>
            </tr>
  </table>
By: TomH
Date: 2008-07-07
Time: 18:47

Re: Problem with data in a block

As always...

First confirm the your db query is returning what you expect.

Use something (NOT TBS) to see the internals of the query result.

After you are positive the query result is correct, then you can post your php code that is being used to drive the template blocks.
By: Trent
Date: 2008-07-07
Time: 19:50

Re: Problem with data in a block

Thanks Tom.  You helped me find my problem easily.  I realized that from the statement below that I use, both tables contain the field 'status' and that was causing the errors.

$TBS->MergeBlock('inbox','tbssql','SELECT i.*,u.* FROM pm i LEFT JOIN characters u ON (i.sender=u.cid) where i.cid = ' . $cid . ' and i.status < 2 ORDER BY i.pm_id DESC LIMIT 15');