0
This error appeared after hosting migration.
Warning: number_format() expects parameter 1 to be float, string given in /home/bramo472/public_html/evolucamp.com.br/doutor/_app/Helpers/Orcamento.class.php on line 105
Warning: number_format() expects parameter 1 to be float, string given in /home/bramo472/public_html/evolucamp.com.br/doutor/_app/Helpers/Orcamento.class.php on line 105
Warning: number_format() expects parameter 1 to be float, string given in /home/bramo472/public_html/evolucamp.com.br/doutor/_app/Helpers/Orcamento.class.php on line 105
Warning: number_format() expects parameter 1 to be float, string given in /home/bramo472/public_html/evolucamp.com.br/doutor/_app/Helpers/Orcamento.class.php on line 105
Warning: number_format() expects parameter 1 to be float, string given in /home/bramo472/public_html/evolucamp.com.br/doutor/_app/Helpers/Orcamento.class.php on line 105
Warning: number_format() expects parameter 1 to be float, string given in /home/bramo472/public_html/evolucamp.com.br/doutor/_app/Helpers/Orcamento.class.php on line 105
MENSAGEM
Erro ao cadastrar: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'como_conheceu' in 'field list
Database:
File that is accused error:
//Monta a tabela com os itens do carrinho
private function AmmountCart() {
if (isset($_SESSION['CARRINHO']) && !empty($_SESSION['CARRINHO'])):
$this->Data['orc_cart'] = null;
foreach ($_SESSION['CARRINHO'] as $IDPRO => $PRODUCT):
$produtos .= "<tr><td> Código: </td> <td> <strong> {$PRODUCT['prod_codigo']} </strong> </td></tr>";
$produtos .= "<tr><td> Produto: </td> <td> <strong> {$PRODUCT['prod_title']} </strong> </td></tr>";
$produtos .= "<tr><td> Valor unitário: </td> <td> <strong> R$ ". number_format($PRODUCT['prod_preco'], 2, ',', '.')." </strong> </td></tr>";
$produtos .= "<tr><td> Modelos: </td> <td> <strong>Quantidades:</strong> </td></tr>";
foreach ($PRODUCT['modelos'] as $itens => $quantidade):
$produtos .= "<tr><td> {$itens} </td> <td> <strong> {$quantidade} </strong> </td></tr>";
endforeach;
$produtos .= "<tr style='background: #eee; border-bottom:1px solid #ccc; padding: 2px; height:2px;'><td ></td><td></td></tr>";
endforeach;
$produtos .= "<tr><td>Valor total </td><td>R$ {$this->Total}</td></tr>";
$this->Data['orc_cart'] = $produtos;
endif;
}
This is line of error:
$produtos .= "<tr><td> Valor unitário: </td> <td> <strong> R$ ". number_format($PRODUCT['prod_preco'], 2, ',', '.')." </strong> </td></tr>";
You used
number_format($PRODUCT['prod_preco'], 2, ',', '.')
and the error says:number_format
expecting a float as input, but you passed a string. It follows, then, that$PRODUCT['prod_preco']
is a string and you need to convert to float.– Woss
Of a
var_dump
in the variable$PRODUCT['prod_preco']
, some character is coming wrong, can even be a comma in place of dot or white spaces.– Gabriel Heming
I gave one
var_dump
the result wasNULL
. How could you convert to float?– wiliamvj
Is it something in the hosting? used Ocaweb and worked, now migrated the client to hostgator and generates this error
– wiliamvj
It’s more likely to be a logic error in your code. If you’re coming
NULL
and should not be null, you did wrong thing.– Woss