Page 1 of 1

Problems with BLOB

Posted: Fri Aug 11, 2006 9:17 am
by radu
Have 2 tables from different Interbase databases whichform

Code: Select all

CREATE TABLE I54 
(
  N_INT	INTEGER,
  ROM	BLOB SUB_TYPE TEXT SEGMENT SIZE 90 CHARACTER SET UNICODE_FSS,
  ENG	BLOB SUB_TYPE TEXT SEGMENT SIZE 90 CHARACTER SET UNICODE_FSS,
  RUS	BLOB SUB_TYPE TEXT SEGMENT SIZE 90 CHARACTER SET UNICODE_FSS
);
The second table "TITLE" has the same structure.
What i'm trying to do is to select fields from table 154 and input them in table
"TITLE".
This is the code:

Code: Select all

$query4="SELECT N_INT, ROM, ENG, RUS FROM I54 WHERE N_INT ".available($n_ints)." ORDER BY N_INT ;" ;
    
	$result_select2 = ibase_query($db, $query4);
	
	while ($data = ibase_fetch_object($result_select2)) {
     	    
	$query5="INSERT INTO TITLE VALUES(".$row->N_INT.",".$row->ROM.",".$row->ENG.",".$row->RUS.");";
    $result_insert2 = ibase_query($db2, $query5);
    }
function "available" returns a string of the form "IN(1,2,3,4,5)"

I get the following warnings;


Warning: ibase_query() [function.ibase-query]: Dynamic SQL Error SQL error code = -104 Token unknown - line 1, char 29 x0000003200000091 in c:\HOST\localhost\interbase\convert2.php on line


if i try for example to output the blob

Code: Select all

echo $row->N_INT;  ibase_blob_echo($row->ROM);
i get:
12 Warning: ibase_blob_echo() [function.ibase-blob-echo]: invalid BLOB ID in
This meens that just

Code: Select all

echo $row->N_INT;
is outputed.
I've tested the query for selection in interbase itself and it works.

Any suggestions?

Posted: Fri Aug 11, 2006 9:24 am
by Ollie Saunders
Recommendation: Change your topic subject to reflect that you are using the ibase database

Code: Select all

$query4="SELECT N_INT, ROM, ENG, RUS FROM I54 WHERE N_INT ".available($n_ints)." ORDER BY N_INT ;";
...becomes...

Code: Select all

$query = 'SELECT N_INT, ROM, ENG, RUS FROM I54 WHERE N_INT = ' . available($n_ints) . ' ORDER BY N_INT;';
(equals or any other operator you meant to put in between WHERE N_INT and available($n_ints))