I'm having trouble with this insert statement. It is inside an if statement and used after a user successfully uploads and image.
$contenido = $filename;
$db = new PDO(DB_DSN, DB_USERNAME, DB_PASSWORD);
$data = $db->prepare("INSERT INTO publicaciones (autorID, autorNombre, nombre, claseDeContenido, contenido, palabras, etiquetas, fecha) VALUES (:autorID, :autorNombre, :nombre, :claseDeContenido, :contenido, :palabras, :etiquetas, :fecha)");
$data->execute(array( ':autorID,' =>$autorID,
':autorNombre' =>$autorNombre,
':nombre' => $nombre,
':claseDeContenido' => $claseDeContenido,
':contenido' => $contenido,
':palabras' =>$palabras,
':etiquetas' => $etiquetas,
':fecha' => $fecha));
The error is
PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: parameter was not defined in .... on line 215
But there is no change of that variable name within the script, there are eight parameters to insert and I am sending 8. I have checked and $fecha, which is on line 215, is definitely being sent.
What could it be?
None of this function is run without all fields being present in their respective variables.
if($autorID !== '' || $autorNombre !== '' || $nombre !== '' || $claseDeContenido !== '' || $contenido !== '' || $palabras !== '' || $etiquetas !== '' || $fecha !== '')
NOTE: The image is uploading succesfully