Buy Now
Sign in

Unable to save to DB - error 1054

fkrolik , November 20 2020, 12:07
F
fkrolik 13
November 20 2020, 12:07 #394946
Hi there!
I've encountered something that seems to be a bug in Chronoforms 7.
I created a "Connectivity style" form that's supposed to get two values from the DB according to the user's actions, and save them into a different table. First part is perfectly fine, but when it comes to saving I get an error. My form only includes two hidden inputs that I carefully named after the corresponding DB fields, there is a behaviour named "Save data" on both of them, and the "Save data" action is set to save "Whole form data". Upon submitting the form I get an error "1054 - Unknown column 'Array' in 'field list'", which is, I suspect, a MySQL error.
I'm new to ChronoForms, so there is a probability that I may be doing something wrong, but I didn't find another clear and transparent way of saving the data.
Thanks!
admin 30
November 20 2020, 13:54 #394949
 Answer
that's a bug, to be fixed in the next update, please wait for that or let me know if you need a quick patch file!
F
fkrolik 13
November 20 2020, 14:45 #394956
Hi Max!
Thanks for the quick reply!
I certainly can wait for the next update for some time.
If it's not too bothering, I'd like to share an idea that you may find useful. I am now learning ChronoForms, sometimes having troubles with constructing queries, and I really miss the ability to just type my SQL and get some results. I know I can use custom PHP, but that also involves establishing a DB connection and forming some sort of array of data which I have no idea how to use further on. So I'm really keen to be able to just put my own SQL in "Read data" or "Save data" actions instead of constructing it, and then deal with the results in the usual ChronoForms fashion.
Thanks,
Valentin.
admin 30
November 22 2020, 00:09 #394978
then deal with the results in the usual ChronoForms fashion
how do you usually deal with the results ?
F
fkrolik 13
November 22 2020, 10:38 #394979
Well, I put the name of my 'Read data' unit as a 'Data source' for a table list or a repeater (the latter is more relevant to me), and then just put something like {var:events.title} wherever I need it.
I tried and composed a rather sophisticated SQL right after I posted the previous message, and sent it off to the database using a custom PHP. To my greatest surprise it worked at the first attempt, and I got a nice set of data, but now I don't know how to use it. I put the name of PHP unit to 'Data source' field of a table list view, and used the keys of the associative array of data that I've got, and something happened but not what I was craving for: I got a PHP warning "Invalid argument supplied for foreach() in /var/www/u0655779/data/www/my_domain/administrator/components/com_chronoforms7/chronoforms/views/list_table/list_table_output.php on line 114"
admin 30
November 27 2020, 14:06 #395047
The data source expects an array with models names, what is the value returned by the PHP action exactly ? and what did you use in the data source ?
F
fkrolik 13
November 27 2020, 19:50 #395070
My PHP returns an array, and it seems to be in perfect condition, though a bit different from what "Read data" returns. I just put the name of the PHP unit as Data Source, and tried all sorts of things as "Path" - 'eventStarts', 'read_the_tasks_dates.eventStarts', '{var:read_the_tasks_dates.eventStarts}' etc., and nothing works
php3.png
php2.pngphp1.png
Attachments
php1.png
php1.png
(22.28 KiB)
25 Downloads/Views
php2.png
php2.png
(18.27 KiB)
18 Downloads/Views
php3.png
php3.png
(10.29 KiB)
25 Downloads/Views
php2.png
php2.png
(18.27 KiB)
18 Downloads/Views
php2.png
php2.png
(18.27 KiB)
25 Downloads/Views
admin 30
November 29 2020, 01:33 #395076
 Answer
{var:read_the_tasks_dates}
should be the data source!
admin 30
November 29 2020, 01:36 #395077
 Answer
The "path" is also wrong, according to your data, the paths should be the table field name directly, for example:
taskTitle
F
fkrolik 13
November 29 2020, 11:39 #395088
 1
And it works!
Thanks Max, this is really wonderful, you've been such a help!
I'm buying ChronoForms now for my own website and probably for another project!
Cheers!
admin 30
November 29 2020, 15:03 #395090
No problem!