I can not insert data numbers float [closed]

-2
<?php 
    require_once('cabecalho.php'); 
    require_once('conn.php'); 
?>
<?php
    $nome = $_REQUEST["nome"];
    $preco = $_REQUEST["preco"];              
    $query = "insert into produtos (nome, preco) values ('{$nome}', '{$preco}')";
    if(mysqli_query($conn, $query)){ ?>
    <p class="alert-success">Produto <?= $nome ?> <?= $preco ?> adicionado.</p>
    <?php } else { ?>
    <p class="alert-danger">Produto <?= $nome; ?> não foi adicionado.</p>    
    <?php } ?>   
        </header>
    </section>
<?php include('rodape.php'); ?>
    
asked by anonymous 09.07.2018 / 22:09

1 answer

1

Maybe the problem is in the connection or in the SQL command, try to do the SQL command in this way to see if it works:

$query ="INSERT INTO prudutos (nome,preco)VALUES ('$nome','$preco')";
    
10.07.2018 / 00:34