This topic is locked

blob field

6/6/2007 5:37:02 AM
PHPRunner General questions
L
lucian author

Does anybody know how to copy a Blob field from a table to another table?
I have the following code in Before record updated:
$strSQLInsert = "insert into archive (title, author, filename, content)

values ('".postvalue("value_title")."','".postvalue("value_author")."','".postvalue("value_filename")."','".$values["content"]."')";

db_exec($strSQLInsert,$conn);
All fields are read-only except content.

The new values are inserted in archive table except content which is a BLOB field.

Any suggestion?
Thank you.
Lucian

Alexey admin 6/6/2007

Lucian,
your code looks almost correct.

Use mysql_real_escape_string function for BLOB values:

$strSQLInsert = "insert into archive (title, author, filename, content)

values ('".postvalue("value_title")."','".postvalue("value_author")."','".postvalue("value_filename")."','".mysql_real_escape_string($values["content"])."')";

L
lucian author 6/6/2007

Alexey,
It doesn't work.

I tried $strSQLInsert = "insert into archive (title, author, filename, content) select title, author, filename from docs where".$where
In this way works but I don't know why I can't download the files from archive table. The size of the file from the database seems to be as in original table.
Lucian

Lucian,

your code looks almost correct.

Use mysql_real_escape_string function for BLOB values:

Sergey Kornilov admin 6/6/2007

What do you mean "I can't download the files". How do you download them?
You can use phpMyAdmin or another program to see if record was actually inserted into archive table.

L
lucian author 6/13/2007

I'm downloading the files from a view page. I changed the type of field for content from image to file in visual editor. Now it works fine.

Thank you.

Lucian

What do you mean "I can't download the files". How do you download them?

You can use phpMyAdmin or another program to see if record was actually inserted into archive table.