Buy Now
Sign in

view the database in a table

Irate , December 22 2015
Answered
I
Irate
Hi Bob,

I have no more quote(), but ....

I can't view the database in a table in front end.

In DB Read:

Action label: lecture
enable: yes
my table name
multi read: yes (i have test no)
enable model id: yes
model id: liste
fields: titre,Image,description
conditions :
<table>
<?php
foreach ($form->data['liste'] as $liste):
?>
<tr><td>Titre: <?php echo $liste['titre'];?></td><td>Titre: <?php echo $liste['Image'];?></td><td>Titre: <?php echo $liste['description'];?></td>
</tr>
<?php
endforeach;
?>
</table>

and... Invalid argument supplied for foreach()

Where is my error?
GreyHead
Hi Irate,

I guess that at the time this code is running $form->data['liste'] is either empty or doesn't exist. Please drag a Debugger action into the On Submit event, then submit the form and post the debug - including the 'dummy emails' results here.

Note: if you are using the Easy Wizard you can turn on Debug on the Others tab in CFv4 or the Setup tab in CFv5.

Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
I
Irate
Hi Bob,
in french, je suis une buse
Error message in frontend :
Warning: Invalid argument supplied for foreach() in /var/www/hebergement/lamap44/home/sites/administrator/components/com_chronoforms5/chronoforms/actions/db_read/db_read.php(82) : eval()'d code on line 3
Data Array:
Array
(
[option] => com_chronoforms5
[chronoform] => affichemateriel
[Itemid] =>
[data] => Array
(
[0] => Array
(
[id] => 1
[titre] => portrait
[Image] => 20151213141604_portrait3.jpg
[description] => portrait3
)

[1] => Array
(
[id] => 2
[titre] => corps humain
[Image] => 20151218143405_corps_humain_01.jpg
[description] => squelette,...
)

)

)

Array
(
)

errors:
Array
(
)

Debug Info:
Array
(
[2] => Array
(
[DB Read] => Array
(
[Queries] => Array
(
[0] => SELECT `data`.`id` AS `data.id`, `data`.`titre` AS `data.titre`, `data`.`Image` AS `data.Image`, `data`.`description` AS `data.description` FROM `ijklr_chronoengine_chronoforms_datatable_newmateriel` AS `data`
)

)

)

)

In DB Read:

Action label: lecture

enable: yes

my table name: chron.... datatable_newmateriel

multi read: yes

enable model id: yes

model id: data

fields: id,titre,Image,description

conditions :
<table>
<?php
foreach ($form->data['newmateriel'] as $materiel):
?>
<tr><td>Titre: <?php echo $materiel['titre'];?></td><td>Image: <?php echo $materiel['Image'];?></td><td>Description: <?php echo $materiel['description'];?></td>
</tr>
<?php
endforeach;
?>
</table>

I'm going round and round in circles

Bruno
GreyHead
Hi Bruno,

I can't match the error message you are seeing with the code in the latest version of ChronoForms for Joomla! 2.5. Please will you check which version you have and upgrade if necessary. That may not fix the problem but should help find out what is happening.

Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
I
Irate
I have upgraded it.

Bruno
GreyHead
Hi Irate,

And what error message do you see now?

Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
I
Irate
Hi Bob,

Warning: Invalid argument supplied for foreach() in /var/www/hebergement/lamap44/home/sites/administrator/components/com_chronoforms5/chronoforms/actions/db_read/db_read.php(85) : eval()'d code on line 3

Bruno
admin
it should be
$form->data['data']
and that code should be inside a "custom code" action, not in the "conditions" box.

Regards,
Max
Max
If your main question got answered then please mark the answer using the button!​
​Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
I
Irate
Thank's Max

It's ok now.

Best regards

Bruno