Hi,
i have this custom PHP code for saving data into table in a cycle foreach()
but don't work.
If i write this
it's ok.
If i write this
it's ok too.
But if i add "foreach cycle" and "INSERT query" it don't work.
Why?π(((((
P.S.: Sorry for my english
i have this custom PHP code for saving data into table in a cycle foreach()
<?php
$bb=$form->data['SERVIZI'];
foreach ($bb as $a)
{
$db =& JFactory::getDBO();
$query = "INSERT INTO `PeF_chronoengine_chronoforms_datatable_Listino1`(`id`, `uniq_id`, `user_id`, `created`, `modified`, `servizio_id`, `prezzo`) VALUES ('','','','','','$a['id']','3')";
$db->setQuery($query);
$db->query();
}
?>
but don't work.
If i write this
<?php
$bb=$form->data['SERVIZI'];
foreach ($bb as $a)
{
echo $a['id'];
}
?>
it's ok.
If i write this
<?php
$db =& JFactory::getDBO();
$query = "INSERT INTO `PeF_chronoengine_chronoforms_datatable_Listino1`(`id`, `uniq_id`, `user_id`, `created`, `modified`, `servizio_id`, `prezzo`) VALUES ('','','','','','2','3')";
$db->setQuery($query);
$db->query();
?>
it's ok too.
But if i add "foreach cycle" and "INSERT query" it don't work.
Why?π(((((
P.S.: Sorry for my english