PDO::PARAM for type decimal?

前端 未结 4 595
余生分开走
余生分开走 2020-11-28 11:06

I have 2 database fields

`decval` decimal(5,2)
`intval` int(3)

I have 2 pdo queries that update them. The one that updates the int works ok

4条回答
  •  有刺的猬
    2020-11-28 11:33

    I found a solution, send the decimal parameter like PDO::PARAM_STR, in the sql server store procedure receive it like decimal(int,dec)

    PHP

    $stmt_e->bindParam(':valor_escala_desde', $valor_escala_desde, PDO::PARAM_STR);
    

    SQL SERVER, STORE PROCEDURE:

    @valor_escala_desde decimal(18,2),
    

    and is done.

提交回复
热议问题