Categories > TinyButStrong general >

Problem with TBS->MergeBlock

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Ronei
Date: 2009-01-09
Time: 13:08

Problem with TBS->MergeBlock


Hello I am having a personal problem in TBS-> MergeBlock with Firebird in this research is the command:

include_once('tbs/plugins/tbsdb_firebird.php');
conn = ibase_connect("192.168.1.244:D:\BD\gestaoescolar.fdb","SYSDBA","masterkey", "ISO8859_1");

TBS->MergeBlock('blk_submenu',$conn,'SELECT T8_ID,T8_NOME,T8_ID_MENU FROM t8_SUBMENU WHERE t8_ID_MENU =1');

but this gives this message:

TinyButStrong Error in field [blk_submenu.t8_NOME...] : item 't8_NOME' is not an existing key in the array. This message can be cancelled using parameter 'noerr'.

   
MySql works in pefeitamente, take much of a solution, a direct search at Firebird without using TBS pefeitamente also works, I am waiting
By: TomH
Date: 2009-01-09
Time: 15:11

Re: Problem with TBS->MergeBlock

From what you describe, the most possibilities for the error message you are getting...
(1) the connection or query is not being performed
(2) the query is made but the result is not what is expected

I would first test the #2 possibility from TBS.
Try add something like this in your PHP
$conn = ibase_connect("192.168.1.244:D:\BD\gestaoescolar.fdb","SYSDBA","masterkey", "ISO8859_1");
$stmt = "SELECT T8_ID,T8_NOME,T8_ID_MENU FROM t8_SUBMENU WHERE t8_ID_MENU =1";
$sth = ibase_query($conn, $stmt);
$showresult = print_r($sth, true);

And in your html add something like
show query result = <pre>[var.showresult]</pre>

Then you at least might know which part is failing.

Hope that helps a little,
TomH
By: Ronei
Date: 2009-01-09
Time: 18:31

Re: Problem with TBS->MergeBlock

   
TomH Okay, thank you for the answer, I believe that the SELECT correct this with your test because the return was "Resource id # 6", and my access to this system working pq he ja USA SELECT in a Firebird, the problem is being when the $ TBS-> MergeBlock try to run the search, where the message that you sent earlier, if you have another idea please post here now ... thanks.
By: TomH
Date: 2009-01-09
Time: 20:37

Re: Problem with TBS->MergeBlock

Ronei,
The message "Resource id # 6" tells me that the result is not correct yet, because TBS must see an array to be used in the MergeBlock.

I am not familiar with the correct syntax for ibase commands - try maybe something like
$sth = ibase_fetch_object($stmt);

See if the $showresult now gives you an array!

Then do something like
$TBS->MergeBlock('blk_submenu', 'array', $sth );
to get the array to merge

Hope it helps,
TomH
By: TomH
Date: 2009-01-09
Time: 20:56

Re: Problem with TBS->MergeBlock

I forgot to ask you if there was a typing error in your first post

You wrote [blk_submenu.t8_NOME...]  but the sql query is for 'T8_NOME'

See 't8' and 'T8' not the same, maybe the problem
By: Ronei
Date: 2009-01-10
Time: 13:34

Re: Problem with TBS->MergeBlock

   
TomH again thank you for your attention, I'm Brazilian and this is why the name of the table in the bank and its name is "T8_SUBMENU" I tried also with upper and lower case, not working, I did what you asked for Interbase and mount an array-USA as in the example below:

$sql_submenu = "SELECT T8_ID,T8_NOME,T8_ID_MENU FROM t8_SUBMENU WHERE t8_ID_MENU =1";
$sql_submenu = ibase_query($conn, $sql_submenu);
$sub = ibase_fetch_assoc($sql_submenu);
$showresult = print_r($sub, true);
.
.
.
$TBS->MergeBlock('blk_submenu', 'array', $sub);

   
in the $ showresult "HTM" was printed this result:

Array

(

    [T8_ID] => 1

    [T8_NOME] => Cadastrar

    [T8_ID_MENU] => 1

)

then the result is correct it printed an Array, but still giving the error message:

TinyButStrong Error in field [blk_submenu.t8_NOME...] : item 't8_NOME' is not an existing key in the array. This message can be cancelled using parameter 'noerr'.

   
Note: I found a detail that can help in the solution, the only creates tables Interbase "uppercase" and I think that the $ TBS-> ta MergeBlock identifying the name so as "small cap" laughs actually think I do not know OQ.
By: Ronei
Date: 2009-01-10
Time: 13:58

Re: Problem with TBS->MergeBlock

TomH again thank you for your attention, I'm Brazilian and this is why the name of the table in the bank and its name is "T8_SUBMENU" I tried also with upper and lower case, not working, I did what you asked for Interbase and mount an array-USA as in the example below:

$sql_submenu = "SELECT T8_ID,T8_NOME,T8_ID_MENU FROM t8_SUBMENU WHERE t8_ID_MENU =1";
$sql_submenu = ibase_query($conn, $sql_submenu);
$sub = ibase_fetch_assoc($sql_submenu);
$showresult = print_r($sub, true);
.
.
.
$TBS->MergeBlock('blk_submenu', 'array', $sub);


in the $ showresult "HTM" was printed this result:

Array

(

    [T8_ID] => 1

    [T8_NOME] => Cadastrar

    [T8_ID_MENU] => 1

)

then the result is correct it printed an Array, but still giving the error message:

TinyButStrong Error in field [blk_submenu.t8_NOME...] : item 't8_NOME' is not an existing key in the array. This message can be cancelled using parameter 'noerr'.


Note: I found a detail that can help in the solution, the only creates tables Interbase "uppercase" and I think that the $ TBS-> ta MergeBlock identifying the name so as "small cap" laughs actually think I do not know OQ.
By: TomH
Date: 2009-01-10
Time: 14:50

Re: Problem with TBS->MergeBlock

Good that you can now see the values in the array!

TBS can now be able to process the MergeBlock

Please, change all your TBS block definitions from this
[blk_submenu.t8_NOME]
change to
[blk_submenu.T8_NOME]
By: Ronei
Date: 2009-01-11
Time: 21:49

Re: Problem with TBS->MergeBlock

Kkkkkk very strange I had done that I do not know why more had not true, but now changed and worked, much thanks for your attention a hug TomH