How do use WHERE LIKE %...% with field value?

Use a WHERE LIKE clause with a form field value in ChronoForms.

Overview

The issue is not knowing the correct syntax to insert a form field value into a LIKE condition.
To use the form field value, concatenate it with the percent signs directly in the array value for the condition.

Answered
Cy CyborgPrime 11 Dec, 2016
I have a field containing a name called selected_name.
I want to return all records WHERE the name is LIKE selected_name

I know that I'm on the right track with this example:

<?php
return array( 'model_id.column LIKE' => '%value%' );
?>


How do i get:
$form->data['selected_name'].

into the value spot? I guess I dont understand the syntax
Cy CyborgPrime 11 Dec, 2016
Answer
Figured it out

"%".$form->data['selected_name']."%"
Gr GreyHead 11 Dec, 2016
Hi CyborgPrime,

I updated the FAQ to include a second example.

Bob
This topic is locked and no more replies can be posted.