1
I am with the following problem, I have a sales registration system, and in these sales I can add a product for each order, but as I would add several products to 1 order ?
Registration code of the sale :
<?php
ini_set('default_charset','UTF-8');
if(isset($_POST['send'])){
$venda = $_POST['num_venda'];
$data = $_POST['data_venda'];
$placa = $_POST['placa'];
$km = $_POST['km'];
$produtos = $_POST['produtos'];
$servicos = $_POST['servicos'];
include ('banco.php');
mysql_query("INSERT INTO venda(id_venda, num_venda, data_venda, placa, km, produtos, servicos)
values(
NULL,
'{$venda}',
'{$data}',
'{$placa}',
'{$km}',
'{$produtos}',
'{$servicos}'
)
");
mysql_query("INSERT INTO vendaproduto (id_venda, produtos) SELECT venda.id_venda, venda.produtos FROM venda ORDER BY venda.id_venda DESC LIMIT 1")or die(mysql_error());
mysql_query("INSERT INTO vendaservico (id_venda, servicos) SELECT venda.id_venda, venda.servicos FROM venda ORDER BY venda.id_venda DESC LIMIT 1")or die(mysql_error());
}
header("location:lista.php");
?>
I have 3 tables , sale , products , vendaproduts , i take the information of the first 2 tables and insert in the table vendaproduts that would look like this :
How’s your bank modeling?
– user28595
How about a field in the form called quantity?
– rray
I edited explaining a little about my tables
– Matheus Goes
How are the tables related?
– gato