Ver Mensaje Individual
  #1 (permalink)  
Antiguo 28/02/2018, 15:19
mathdz
 
Fecha de Ingreso: mayo-2012
Mensajes: 24
Antigüedad: 12 años
Puntos: 0
Información Consulta PDO manda error al ejecutarse.

Buenas tardes.

Quiero ejecutar un procedimiento sql, el procedimineto me regresa una serie de filas pero al ejecuarlo manda el siguiente error:

Warning: Uncaught PDOException: SQLSTATE[42000]: [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Sintaxis incorrecta cerca de '@P1'.

PDOStatement->execute() #1

Fatal error: Illegal or unknown output parameter type. This should have been caught in core_sqlsrv_bind_parameter.

La consulta la estoy haciendo de la siguiente forma:

Código PHP:
$query $this->db->prepare('CALL '.$name_sp.'(?,?,?,?,?)');
$param 'undefined';
$param2 0;
$sentencia 'select';
    
$query->bindParam(1,$param,PDO::PARAM_STR,20);
    
$query->bindParam(2,$param,PDO::PARAM_STR,20);
    
$query->bindParam(3,$param2,PDO::PARAM_INT,5);
    
$query->bindParam(4,$param,PDO::PARAM_STR,20);
    
$query->bindParam(5,$sentencia,PDO::PARAM_STR,20);
$query->execute(); 
No se si sea la forma correcta, favor si alguien me podria decir cual es la forma correcta.