-8
I have this code to send values to a table in the database, it is not displaying any, it is simply not sending values
<?php
include "../../lib/inc_con.php";
$mesa = $_POST['mesa'];
$tamanho = $_POST['tamanho'][0];
$quantidade = $_POST['qtd'];
if(empty($_POST['valor'])) { $adicional = "Nenhum"; } else { $adicional = implode(',', $_POST['valor']); }
$hiddentotal = $_POST['hiddentotal'];
date_default_timezone_set('America/Sao_Paulo');
$mysqldata = new DateTime();
$data = $mysqldata->format(DateTime::ISO8601);
$hora = date('H:i:s');
$produto_id1 = $_POST['produto_id1'];
if (empty($_POST['observacao'])){ $observacao = "Nenhuma"; } else { $observacao = $_POST['observacao']; }
$produzido = '0';
$valortotal = $quantidade * $hiddentotal;
$asplo = $_POST['asplo'];
$conta = '0';
$pdo=conectar();
$inserirpedido=$pdo->prepare("INSERT INTO pedidos FROM produtos(mesa,tamanho,qtd,adicional,valortotal,data,produto_id1,produzido,observacao,asplo,conta,hora,horadeproducao) VALUES ('$mesa', '$tamanho', '$quantidade', '$adicional', '$valortotal', '$data', '$produto_id1', '$produzido', '$observacao', '$asplo')");
$inserirpedido->execute();
?>
Check the error,
if(!$inserirpedido->execute()){ print_r($inserirpedido->errorInfo());}
– rray
Take that
FROM
...– rray
I took the FROM products I had not seen but still not inserting
– Alfredo Lima
and the error that returned now with errorInfo is that the column count does not match the value count, I will check and I again make contact, thanks for the help.
– Alfredo Lima
That comment code, returned which error?
– rray
There are no columns associated for the last 3 values.
– rray
that’s right, I defined them only now he’s entering 2 identical records at once, you know why?
– Alfredo Lima
you call twice execute?
– rray
Negative, but you can let me take a look here, usually the mistakes they give are lack of attention my, obg for help, anything I create a new question...
– Alfredo Lima