1
I have a API in PHP and a app done with Ionic 3.
I’m getting from the app a string this way "200,300,40
" and the same thing "polimento,pintura,lavagem
".
I would like to know how to register each number and name of this separate on insert
line by line ?
There are other data besides these numbers like date etc.. but it comes only a simple record without comma type: 23/04/2016
I would have no problem repeating them on the bank line". So I wanted it to stay line by line.Like:
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++;
}
Please put an example code so we can help you.
– William Aparecido Brandino