Search code examples
phppostgresqlimagemagickimagick

How to reference an Imagick object in a PHP UPDATE query?


What is wrong with this query?

Am trying to write an ImageMagick object back into a database (a PostgreSQL bytea field). This is PHP code - using the Imagick functions.

$query = "UPDATE table SET destcol = ".$im." WHERE key = " .$args[0];

Solution

  • I'm going to guess that you're updating string columns without quoting them.;

    $query = "UPDATE table SET destcol = '".$im."' WHERE key = '" .$args[0]. "'";