I need to dynamically generate the column name I need to update in Postgresql from PHP. Here's the code and the error:
$Col = "dog_".$Num."_pic";
$query_params = array(
':user_id_' => $CustomerID,
'dog_path' => $filePath,
'dog_col' => $Col)
;
$sql = "UPDATE users
SET
`:dog_col`=:dog_path
WHERE `username`=:user_id_";
I also tried pg_escape_string() with the string.
Here's the error.
"SQLSTATE[42S22]: Column not found: 1054 Unknown column ''dog_1_pic'' in 'field list'"}