0
I have the following variable:
$ids = "758,749";
Table has columns: id, id_provider, accepted.
When running a PHP script, I would like it to do something like this:
INSERT INTO tabela (id, id_prestador, aceite) VALUES (null, $iddecadaprestador1, '0');
INSERT INTO tabela (id, id_prestador, aceite) VALUES (null, $iddecadaprestador2, '0');
That is, the id_provider column is variable, and each value is within the $ids variable and the other fields are fixed.
Fields separated by comma ? 758 would be a $iddecadaprestador1 and 749 the other $iddecadaprestador1?
– novic
If id is pk and auto increment, you don’t even need to use in your query, now in your specific problem... just give a
$a = explode(",",$ids)
and make aforeach($a as $id_prestador){ $Query = "seu insert".$id_prestador; } echo $Query;
– MarceloBoni
isos, each number would be an id
– Leandro Marzullo
thanks @Marceloboni worked right!
– Leandro Marzullo