I have a API in PHP and an app
I'm getting a string like this from the app " 200,300,40
" and the same thing " polimento,pintura,lavagem
" from the app.
I would like to know how to register each number and name of that separated in insert
line by line?
There are other data besides numbers like date etc., but it only comes with a simple non-comma record: 23/04/2016
would have no problem repeating them on the bank line. "So I wanted this to stay line by line. Type:
nome_servico valor_servico data_servico id_usuario .......
polimento 200 23/04/2016
pintura 400 23/04/2016
lavagem 40 23/04/2016
$count= 0;
$max = count($varnome);
while($count <= $max){
$sql = "insert into pedido(nome_servico,valor_servico,id_usuario,total_servico,data_servico,id_empresa,n_pedido)values('".$varnome[$count]."','".$varvalor[$count]."','".$id_usuario[$count]."','".$total_servico[$count]."','".$data_atual[$count]."','".$id_empresa[$count]."','".$comp_ped[$count]."')";
$count++;
}