Forums

read data

E
ernst@volny.cz posted May 16, 2023 at 17:37
how do I get it loaded from the database:

i looked at this tutorial but it doesn't work - https://www.chronoengine.com/forums/topics/view/108638/access-table-data

i need data in php but {var:Model.field} or $this->get("Model.field") doesn't work

http://testvaz.cz.uvds510.active24.cz/chrono7.png
V
vdneut posted May 16, 2023 at 18:40
1 Likes
This might help: https://www.chronoengine.com/forums/topics/view/110075/calculation-of-fields-in-chronoforms7#p399000
Turn on debug information. The array might give a clue as well.
E
ernst@volny.cz posted May 16, 2023 at 18:53
I need to get to the result of read data (from database ) in action,
I can see the results in debug, but I can't get to them.
something like $this->get('read_data_107.id') or $this->get('Model107.id') doesn't work
V
vdneut posted May 16, 2023 at 21:43
Did you select the Set Models Data behavior in the Data input field of the Read Data action?
E
ernst@volny.cz posted May 18, 2023 at 12:50
yes I have.
In debug I get:
[read_data_164] => Array
(
[result] => Data read successfully!
[log] => Array
(
[0] => SELECT `Model174`.`form_id` AS `Model174.form_id`, `Model174`.`approved` AS `Model174.approved`, `Model174`.`created` AS `Model174.created`, `Model174 `.`modified` AS `Model174.modified`, `Model174`.`ipaddress` AS `Model174.ipaddress`, `Model174`.`page` AS `Model174.page`, `Model174`.`data` AS `Model174 .data`, `Model174`.`name` AS `Model174.name`, `Model174`.`email` AS `Model174.email`, `Model174`.`phone` AS `Model174.phone`, `Model174`. `right' AS `Model174.right', `Model174`.`count_of_pieces' AS ``Model174.count_of_pieces'', `Model174`.`select' AS `Model174.select', `Model174`.`need' AS `Model174.need' `, `Model174`.`thermo` AS `Model174.thermo`, `Model174`.`number_of_pieces1` AS ``Model174.number_of_pieces1`, `Model174`.`files1` AS `Model174.files1`, `Model174`.`print options ` AS `Model174.print options`, `Model174`.`print` AS `Model174.print`, `Model174`.`ordering` AS `Model174.ordering`, `Model174`.`state` AS `Model174.state`, AS `Model174.post_name`, `Model174`.`address` AS `Model174.address`, `Model174`.`termin` AS `Model174.termin`, `Model174`.`id` AS `Model174.id` FROM `g5pw9_chronog3_dataform ` AS `Model174` LIMIT 1;
)

[var] => Array
(
[Model174] => Array
(
[form_id] => order-form
[approved] => 1
[created] => 2023-05-18 12:43:58
[modified] => 2023-05-18 12:43:58
[ipaddress] => 89.177.186.11
[page] => 1
[data] => data
[name] => Miroslav Ernst
[email] => ernst@volny.cz
[phone] =>
[right] =>
[count_of_kusup] => 1
[select] => 1
[need] =>
[thermo] =>
[number_of_pieces1] => 1
[files1] => none
[print options] => 1
[print] => 1
[state] => 1
[price] => 850
[published] => 1
[branch] =>
[branch_name] =>
[address] =>
[term] =>
[id] => 154
)

)

)

but how do i find the field value in the table? For example id.

In html and php
P
Pkoll posted May 18, 2023 at 18:57
In the field advanced settings you define “value and placeholder”
Then in de field: {var:Model174.id} of {var:read_data_174.Model174.id}.
V
vdneut posted May 20, 2023 at 09:49
As a general approach to find things out how they work, I take a demo form and first try out the ting I want to achieve.
For example, load the Basic Article List example as it is the mother of all CF7 demo's.
Then add a Advanced/PHP element just below a read Action, for example in the 'edit' page and write something like this:
echo "<p>var: ".$this->get("Article.title", "No title")."</p>";
echo "<p>data: ".$this->data("Article.title", "No title")."</p>";
And watch the result. If no result, try adding the Set Models Data behavior in the Data input field of the Read Data action.
Get any result? Compare it with what you have and smooth out any difference until your form works.
In this case the get should give you a result.
You need to login to be able to post a reply.

 2Checkout.com

2CheckOut.com Inc. (Ohio, USA) is an authorized retailer for
goods and services provided by ChronoEngine.com