Hello,

The option PGSQL_DML_STRING doesn't work with pg_update to me. I try the same option with pg_insert and it worked as I expected, but with pg_update I can't see the query and it is executed.

I have an error in the query and I need to debug, so watch it is imperative.

Anybody can help me to know what I need to do to be able to debug the query?

Thanks in advance.

CODE AND RESULT AT THE BROWSER:
function Update_internal($taula, $elements, $id, $dieonerror=true, $format_date=true) {
   $link = Conectar();
   pg_query($link, 'SET DateStyle TO ISO');
   foreach (array_keys($elements) as $k) {
     $elements[$k]=stripslashes($elements[$k]);
     if ($format_date && $elements[$k]) {
        if (preg_match('/^(\d{1,2})[-\/\.](\d{1,2})[-\/\.](\d{4})$/', $elements[$k], $match)) 
        $elements[$k]=$match[3].'/'.$match[2].'/'.$match[1];
     }
   }
 
   $aux = "Update Internal en $taula\n" . print_r($elements,true) . "\nfor ID=$id\n";
   file_put_contents('/tmp/pedidos.log',$aux,FILE_APPEND);						
  
   $res = pg_update($link, $taula, $elements, Array('id' => $id),PGSQL_DML_STRING);
   
   $aux = "QUERY: " . $res . "\n";
   file_put_contents('/tmp/pedidos.log',$aux,FILE_APPEND);               
 
   if ($res) return true;
   if ($dieonerror) dieEx("Error al actualizar los datos en $taula",'Mensaje devuelto por el servidor: '.pg_errormessage ($link));
   return false;
}
 
The only error I can see is at the browser, but any information is shown: 

ERROR
Se ha producido un error al ejecutar el script Número de error:	0
Descripción:	
Error al actualizar los datos en comandes
Mensaje devuelto por el servidor:

--


Reply via email to