Categories > TinyButStrong general >

Problem with empty set from DB

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Andrew
Date: 2005-09-02
Time: 09:26

Problem with empty set from DB

This DB request sometime return empty set
$TBS->MergeBlock('fin',$db_link,'SELECT * FROM finance WHERE id_com='.$com.' ORDER BY date DESC LIMIT 0,1');

My template
<div>[onshow;when [fin.#;noerr]!=0; magnet=div; mtype=m*m]
<p><strong>Activ: </strong>[fin.activs][onshow;block=p;when [fin.activs]+-0]</p>
</div>

I want <p>...</p> only display if DB request return not empty set.
If set is empty, this block must be ignored without error.
But  anyway error is occured, although fin.#=0
TinyButStrong Error (Array value): Can't merge [fin.activs] because sub-item 'activs' is not an existing key in the array.
By: Skrol29
Date: 2005-09-02
Time: 14:30

Re: Problem with empty set from DB

When the fix for your previous bug will be released (version 2.05.1), you will be able to use someting like:
  <p>...[onshow;when [fin.#]=0]....<P>
Or with magnet:
  <p>...[fin.$;magnet=p]....<P>
By: Andrew
Date: 2005-09-02
Time: 14:38

Re: Problem with empty set from DB

Thanks!
I will wait that release with impatience.
By: Skrol29
Date: 2005-09-02
Time: 15:09

Re: Problem with empty set from DB

It is available now.
Just tell me if all run ok for you with it.
By: Andrew
Date: 2005-09-02
Time: 15:44

Re: Problem with empty set from DB

And again - BIG THANKS!
I like TBS more and more!
I used this:
<div>[onshow;when [fin.#;noerr]!=0;block=div]
Some info.....
</div>
And it's work!
By: Skrol29
Date: 2005-09-02
Time: 15:57

Re: Problem with empty set from DB

but it should work without parameter 'noerr'.
By: Andrew
Date: 2005-09-02
Time: 16:02

Re: Problem with empty set from DB

You are right! It's works!