Maybe I am just plain stupid but the fact that there is historically nothing like a documentation on this product doesn't make it better ;-)
I want to retrieve one record from the db.
Should not be rocket science.
( should be a feedback form to a recipient who's email is contained in the database - only the record number is transmitted via GET to the form. The website visitor can now fill in a form and send it to the recipients who's email should never be visible in the code. )
The only problem is that the only sentence that should probably give me a clue, about how to enter the SQL condition definiely does not: :-(
"conditions array returned using PHP in array format, e.g: < ?php return array('field' => 'value'); ?>"
Any examples of how to use this?
Best regards
Alex
I want to retrieve one record from the db.
Should not be rocket science.
( should be a feedback form to a recipient who's email is contained in the database - only the record number is transmitted via GET to the form. The website visitor can now fill in a form and send it to the recipients who's email should never be visible in the code. )
The only problem is that the only sentence that should probably give me a clue, about how to enter the SQL condition definiely does not: :-(
"conditions array returned using PHP in array format, e.g: < ?php return array('field' => 'value'); ?>"
Any examples of how to use this?
Best regards
Alex
Hi wnedoe,
Sure, if the number is passed to the form then here is an example code to use in the conditions box:
where "url_num" is the name of the parameter in the link and "num" is the field name in the database.
Regards,
Max
Sure, if the number is passed to the form then here is an example code to use in the conditions box:
<?php
return array("num" => $form->data("url_num"));
where "url_num" is the name of the parameter in the link and "num" is the field name in the database.
Regards,
Max
And this does an SQL select with the syntax:
Select [fields entered above] from [database entered above] where num =$URL.num
??
So that the array is filled with the record which contains num as unique key?
Select [fields entered above] from [database entered above] where num =$URL.num
??
So that the array is filled with the record which contains num as unique key?
This does not work. :-(
Tried all possible variations - nothing.
without condition I do get a record - with condition - nothing not.
The SQL statement of the db read should be displayed in the debug info - this would definitely help .
Tried all possible variations - nothing.
without condition I do get a record - with condition - nothing not.
The SQL statement of the db read should be displayed in the debug info - this would definitely help .
please try this code in a "custom code" action after the "db read":
Where "MODEL_NAME" is the model name set in the db read.
it should display a list of queries, the last is the one executed by the db read.
Regards,
Max
<?php
pr(\GCore\Models\MODEL_NAME::getInstance()->dbo->log);
Where "MODEL_NAME" is the model name set in the db read.
it should display a list of queries, the last is the one executed by the db read.
Regards,
Max
Thank You- I will try this when I encounter sql problems the next time.
In the meantime it works, but it was a hard fight man vs. machine.
I upgraded to 3.2.2 and realized that the id I used to retrieve the record was invalid :-( because one of my employees deleted the duplicate record - unfortunately exactly that I used for testing :-(
Today it worked and I managed to get both - the example below the conditions field and your suggested code to work.
Its hard to say what was the exact reason..
In the meatime I even managed to get the jf5 plugin to work within a different component serving the id using
{chronoforms5}form-name&exnr={joodb field|id}{/chronoforms5}
I think the product is great but the missing documentation for many of the not so intuitive parts of the program is a real problem. So it sometimes takes 10times the effort to find out how something works or not.
Best regards
Alexander Dobernig
In the meantime it works, but it was a hard fight man vs. machine.
I upgraded to 3.2.2 and realized that the id I used to retrieve the record was invalid :-( because one of my employees deleted the duplicate record - unfortunately exactly that I used for testing :-(
Today it worked and I managed to get both - the example below the conditions field and your suggested code to work.
Its hard to say what was the exact reason..
In the meatime I even managed to get the jf5 plugin to work within a different component serving the id using
{chronoforms5}form-name&exnr={joodb field|id}{/chronoforms5}
I think the product is great but the missing documentation for many of the not so intuitive parts of the program is a real problem. So it sometimes takes 10times the effort to find out how something works or not.
Best regards
Alexander Dobernig
Hi Alexander,
We are trying to add more docs for v5, but most of the v4 docs and hints should still work.
And yes, you can pass extra params to the called form in the v5 plugin, this is anew feature!
Regards,
Max
We are trying to add more docs for v5, but most of the v4 docs and hints should still work.
And yes, you can pass extra params to the called form in the v5 plugin, this is anew feature!
Regards,
Max
Hi, with cronoforms v5 is possible to add multiple condition in db_read field conditions?
i've the necessity to show only record in with name + cognome + piva is matching the value in a text box. In the array i've the data correcty but how i can setting the three condition in the db_read?
Array
(
[option] => com_chronoforms5
[chronoform] => Ricerca
[event] => page2
[Cognome] => Mario
[Nome] => Bianchi
[Partita_Iva] => 238
[button12] => Submit
)
with
<?php
return array("Cognome" => $form->data("Cognome"));
it works but only for cognome field.
Thanks
i've the necessity to show only record in with name + cognome + piva is matching the value in a text box. In the array i've the data correcty but how i can setting the three condition in the db_read?
Array
(
[option] => com_chronoforms5
[chronoform] => Ricerca
[event] => page2
[Cognome] => Mario
[Nome] => Bianchi
[Partita_Iva] => 238
[button12] => Submit
)
with
<?php
return array("Cognome" => $form->data("Cognome"));
it works but only for cognome field.
Thanks
Just add more array keys+values:
Regards,
Max
<?php
return array("Cognome" => $form->data("Cognome"), "Nome" => $form->data("Nome"));
Regards,
Max
The default behavior of db_read conditions is either = or IN
The following can be read as
What do you do to get a NOT IN. I wish there is a way to pass in simple SQL. This is driving me nuts. Please help
The following can be read as
$arr = json_decode("[0,3]", true);
return array("id" => $arr ); //id IN (bla bla bla) - good
What do you do to get a NOT IN. I wish there is a way to pass in simple SQL. This is driving me nuts. Please help
This topic is locked and no more replies can be posted.