Categories > TinyButStrong general >

What is wrong with this?

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: DJMoran
Date: 2009-03-21
Time: 20:47

What is wrong with this?

Here are the partial files at the point where it is going wrong and I don't understand why. The id's pulled from the two tables match but the username does not show up when viewed in the browser. Also, it is only the username part which doesn't work, everything else does.

HTML:

<div id="rightcontent">
      <h1>[subBlock.type;block=div;when [var.id]=0]</h1>
      <table width="100%">
        <tbody>
          <tr>
            <th>Title</th>
            <th>Uploader</th>
            <th colspan="6">Score</th>
          </tr>
          <tr class="rowlight" width="100%">
            <td width="50%"><b><a href="./flash.php?id=[subBlock.id]">[subBlock.title;block=tr;p1=[subBlock.type]]</a></b><br /></td>
            <td>[uploaderBlock.username;q1=[subBlock.uid]]</td>
            <td colspan="6">[subBlock.votescore;if [subBlock.votes]-+11;then 'New!';else [val]]</td>
          </tr>
        </tbody>

PHP:

$TBS->MergeBlock('uploaderBlock','mysql','SELECT username, id FROM `users` ');
// Merge the block by page
$TBS->PlugIn(TBS_BYPAGE,$PageSize,$PageNum,$RecCnt); // Next block will be merged suing By-Page mode.
$RecCnt = $TBS->MergeBlock('subBlock','mysql','SELECT * FROM `flash_sub` ORDER BY submitted DESC');
// Merge the Navigation Bar
$TBS->PlugIn(TBS_NAVBAR,'nv','',$PageNum,$RecCnt,$PageSize);


By: DJMoran
Date: 2009-03-21
Time: 20:49

Re: What is wrong with this?

sorry the PHP should read $TBS->MergeBlock('uploaderBlock',mysql','SELECT username, id FROM `users` WHERE id="%q1"');
By: Skrol29
Date: 2009-03-23
Time: 11:39

Re: What is wrong with this?

Hi DJ Moran

Your "uploaderBlock" fields doesn't have the "block=something" parameter. Thus, TBS will merge only the first record (because it doesn't know how tp place the others), and will probably ignore other block parameters because such as "p1".
By: DJMoran
Date: 2009-03-24
Time: 17:22

Re: What is wrong with this?

Thanks, but what would I put in the "block" parameter. And why wouldn't the "q1" block parameter allow the mysql query to pull just one field from the database in the first place?
By: Skrol29
Date: 2009-03-27
Time: 13:57

Re: What is wrong with this?

Hi DJMoran,

> what would I put in the "block" parameter
Parameter "block" is needed to define what is the zone to be repeated for each record of the query.

> why wouldn't the "q1" block parameter allow the mysql query to pull
> just one field from the database in the first place

I assume that you mean p1, not q1.

p1 means that the query expects a dynamic value. If the result of the dynamic gives only one record, then you may don't need parameter block on [subBlock].

By: DJMoran
Date: 2009-03-27
Time: 23:11

Re: What is wrong with this?

it still doesn't work, even when p1 is given a valid value.
By: DJMoran
Date: 2009-03-27
Time: 23:37

Re: What is wrong with this?

i added a block=td to the uploaderBlock and it worked.

I have no idea why it didn't work before (other than the obvious)