-1

I want to move blob from one MySQL table to another table.

I try this:

mysql_query("INSERT INTO test1 Blob SELECT Blob FROM test");

But don't working and try with SELECT, then INSERT, but don't working.

Next question: If I want not Insert to another table, but update in another table what then do?

Deimantas
  • 13
  • 6
  • 1
    `mysql_` functions are deprecated. – wogsland Dec 12 '16 at 19:09
  • 2
    **WARNING**: If you're just learning PHP, please, do not learn the obsolete [`mysql_query`](http://php.net/manual/en/function.mysql-query.php) interface. It's awful and has been removed in PHP 7. A replacement like [PDO is not hard to learn](http://net.tutsplus.com/tutorials/php/why-you-should-be-using-phps-pdo-for-database-access/) and a guide like [PHP The Right Way](http://www.phptherightway.com/) helps explain best practices. Make **sure** your user parameters are [properly escaped](http://bobby-tables.com/php) or you will end up with severe [SQL injection bugs](http://bobby-tables.com/). – tadman Dec 12 '16 at 19:11

1 Answers1

2

Syntax should be:

INSERT INTO test1 (`Blob`) SELECT `Blob` FROM test

What you've done here is to alias test1 as Blob. As always refer to the documentation on SELECT before randomly trying things. As a note, having Blob as a column name can be problematic as it's a reserved keyword.

tadman
  • 208,517
  • 23
  • 234
  • 262