Jeff,

Check your SQL. Shouldn't
$sql = "insert into note_tbl
(note) values ('${note}')
where pkey = '45'";

be UPDATE .... where pkey = '45' ?

Or, do a delete where pkey = '45' followed by an insert. In that case check the synatx of your insert 'cause it doesn't look correct.

HTH - Miles Thompson


At 04:42 PM 11/19/2002 -0800, Jeff Stern wrote:
hi, i am having the devil of a time with this. have been researching it for 3 weeks. have posted to php.faqts.com (no answer), looked a million times on php.net, and www.borland.com/interbase, written people email (no response!) and even tried to get the people at easysoft to answer (they are working on it)..

but it's been 3 weeks now and i cannot seem to get this question answered, and our project is waiting..

the question simply is: how to write a BLOB (sub-typwith ODBC in PHP?

fyi, it shouldn't make a difference, but i am using interbase 6.0 as the back end, and the blob is SUB-TYPE 1 (text).

*reading* the blob is trivial with php Unified ODBC. I just use a normal SQL select statement:

======================================================================
$sql = "select note from note_tbl where pkey = '45'";

# get result
$result = @odbc_exec($conn, $sql);

# assign values
if ( @odbc_fetch_into($result, $row)) {
$note = $row[0];
}
======================================================================

(where notes is the BLOB field). pretty simple.

however, when i try to *write* it back:
======================================================================
$sql = "insert into note_tbl
(note) values ('${note}')
where pkey = '45'";

$result = odbc_exec($conn, $sql);
======================================================================

i get an error message:

======================================================================
Invalid modify request. Conversion error from string "BLOB"
======================================================================

.. so apparently i cannot simply write the string back out to the BLOB.
(tho' IMHO if i can read in a SUB-TYPE 1 (text) BLOB that easily, then i should be able to write it back out that easily).

apparently this is not just at the PHP Unified ODBC level.. if i run easysoft's isql program at the command prompt and try to run the same commands, while i don't get as specific an error message, it does return an error:

======================================================================
SQL> update notes_tbl set note = 'hello there' where pkey = '16784'
[ISQL]ERROR: Could not SQLExecute
SQL> _
======================================================================

does anyone have some example code for how to do this (in PHP)?

i'd be most grateful..


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to