Categories > TinyButStrong general >

MergeBlock Method Error - Failure with Connection?

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: worchyld
Date: 2004-09-16
Time: 11:51

MergeBlock Method Error - Failure with Connection?

I am getting this error during the merging of my php code and TBS code.  Despite getting this error, there are no problems outputting my template - in fact the template works fine - but this error keeps popping up.

TinyButStrong Error (MergeBlock Method): The specified source is set to FALSE. Maybe your connection has failed.

In my code I pull out records from a database and dump the results into a make-shift array called books.  I cannot see where the problem is occuring.

<?php
$books            = unserialize($books);

while ( $row1 = mysql_fetch_array($result1) ) {
   
    $user2_IDno        = fixIt($row1['u1_IDno']);
    $user2_firstname    = fixIt($row1['firstname']);
    $user2_surname        = fixIt($row1['surname']);
    $user2_email        = fixIt($row1['email']);
    $user2_phone        = fixIt($row1['phone']);
    $person2        = $user2_firstname .' '. $user2_surname;
    $surnameFirstChar    = strtoupper(substr($user2_surname, 0, 1));                   

    // update TBS
    $tbs_person2        = $user2_firstname.' '.$surnameFirstChar;

    if ($y->isBlank($user2_email)==true) {
        if ($y->isBlank($user2_phone)==false) {
            $contact_details    = $user2_phone;
            $contact_var        = 'phone';
        } else {
            $contact_details     = '';
            $contact_var        = '';
        } // end if
    } else {
        $contact_details        = ('<a href="mailto:'.$user2_email.'" title="Send E-mail">'.$user2_email.'</a>');
        $contact_var            = 'email';
    } // end if

    if ($y->isBlank($contact_details)==false) {
        $books[]     = $tbs_person2.' - You can '. $contact_var.' '.$tbs_person2.' via '.$contact_details. ' <em>'. $extraNotes.'</em>';
    } else {
        $books[]    = $tbs_person2.' - There are no contact details for '.$tbs_person2 .' <em>'. $extraNotes.'</em>';
    } // end if
   
} // wend

// Merge Array with TBS Block
$TBS->MergeBlock('blk',$books);
?>

Now, the part which is causing the error is the last line, where it states:

$TBS->MergeBlock('blk',$books);

But where is this "false" statement, referenced in the error message, meant to go?

I hope you can help!

By: Skrol29
Date: 2004-09-16
Time: 13:40

Re: MergeBlock Method Error - Failure with Connection?

It means that $books has value false when you merge the block 'blk'.
This value is not supported by TBS and should be an array instead.
By: worchyld
Date: 2004-09-16
Time: 16:07

Re: MergeBlock Method Error - Failure with Connection?

Thank you very much for your help with this.

I don't quite understand what you mean by "this value is not supported by TBS"

Do you mean changing:

$books = unserialize($books);

To an array?

The reason why it is unserialised is because I actually have two queries, the first powers the second, and its inbetween the first and second that I make the unserialization work.

Example;
$sql = "first query details"
while ($result of $sql) {
     get results of first sql details
      unserialize books array
     
      perform second query (see my first post)
} // wend

Please can you verify the value you suggest making an array.

Many thanks.

By: Skrol29
Date: 2004-09-17
Time: 02:54

Re: MergeBlock Method Error - Failure with Connection?

>I don't quite understand what you mean
> by "this value is not supported by TBS"

You have the code
$books = unserialize($books);
This line seems to set the variable $book to false.

Then when you have
$TBS->MergeBlock('blk',$books);
TBS wants $books to be a database identifier or a TBS array.
$book=false is not a supported value for parameter Source of the MergeBlock() method.

By: worchyld
Date: 2004-09-17
Time: 11:55

Re: MergeBlock Method Error - Failure with Connection?

Oh, I understand now, thanks - but I'm not sure how to replace $books - its meant to be made empty each time the 1st row iterates.

Could you suggest a way of resolving this?
By: Skrol29
Date: 2004-09-17
Time: 11:59

Re: MergeBlock Method Error - Failure with Connection?

if (!is_array($book)) $book = array();
$TBS->MergeBlock('blk',$books);
By: worchyld
Date: 2004-09-17
Time: 12:36

Re: MergeBlock Method Error - Failure with Connection?

Thank you so much!