Syntax in DB Read Conditions

HerKle 27 Nov, 2014
Hi,
maybe I'm stupid, but I don't understand how to put the mysql query into the DB Read Condition field with a php array.
The demo doesn't show an example and in the forum here (which shows the results limited to 20 topics on 1st page) I found just this example <?php return array('id' => '17'); ?>, which of course works fine if you have only one condition.

But how to put something simple of mysql query like
"WHERE field1=cond1 AND field2=cond2 ORDER BY field1 ASC" into that php syntax?

Thanks again for your advice.
Kind regards,
Herbert
Max_admin 27 Nov, 2014
Answer
3 Likes
Hi Herbert,

Please check this:
https://www.chronoengine.com/faqs/72-ccv5/5215-how-do-i-build-a-where-statement-in-ccv5.html

You may place any order fields in the "Order" box!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
jpbhcom 17 Apr, 2015
VERY useful info in the FAQ, I'm very pleased with the DB Read functionality in CronoForms v5.

I've had to be a little fancier with my queries in the last few projects I've worked on, your FAQ & component are greatly appreciated.

random-members.html?categories[]=Antiques&categories[]=Not%20a%20Category

<?php
	$categories = $form->data['categories'];
	$db =& JFactory::getDBO();
	$clean = implode(',', $db->quote($categories));
	return array(":CategoryOne NOT IN ($clean) AND CategoryTwo NOT IN ($clean) AND CategoryThree NOT IN ($clean) ORDER BY RAND() LIMIT 1");
?>


Thanks,
Jared
Sten 08 Nov, 2015
HI Max,

My DB Read doesn't run.

Here are my parameters :
Sten 08 Nov, 2015
What is my mistake ?

I would like to send an email with informations of the table after payment validation.
I tested
<?php echo $form->data["nom"]; ?>


and

<?php echo $form->data["nom"]; ?>


but DB Read doesn't run at all.

Excuse for my English.

Sten
GreyHead 08 Nov, 2015
Hi Sten,

Please try
<?php
return array('id' => $form->data['custom']);
?>
Note: [] and not () round 'custom'

Pleas leave the Model ID empty and set Enable Model ID to No unless you are sure that you need it.

Bob
Sten 11 Nov, 2015
Thank you Bob !

I just modify your code replacing it by
<?php
return array(id => $form->data['custom']);
?>

Now, I can read the database. Great !

However I get a problem again : Paypal IPN try many times to log with my form and I receive 8 emails notifications from my form !
Do you know why ?
Sten 11 Nov, 2015
Forgive : my code is
<?php
return array('id' = $form->data['custom']);
?>
Sten 11 Nov, 2015
This is my ipn event
Sten 11 Nov, 2015
I test to disable DB Read and Email et then, in Paypal history IPN, the message is "sent" instead of "retrying".

it looks like DB Read disable IPN event to sent a response to paypal.

Am I wrong ?
Sten 11 Nov, 2015
I just read 'id" in DB Read and replace your code Bob
<?php
return array('id' => $form->data['custom']);
?>


What I know is your chronoforms is gret and I thank Bob and Max very much !
This topic is locked and no more replies can be posted.