I have a wordpress search and it uses the following:
$form_data = $wpdb->get_results(
$wpdb->prepare(
'SELECT * FROM ' . $table . ' ucf WHERE name LIKE "%'.$wpdb->esc_like($this->table_search).'%"',
$this->form_active,
'%' . $wpdb->esc_like($this->table_search) . '%'
)
, ARRAY_A);
The problem is that he does not think that way, but if I put what I want to look like this:
$form_data = $wpdb->get_results(
$wpdb->prepare(
'SELECT * FROM ' . $table . ' ucf WHERE name LIKE "%teste%"',
$this->form_active,
'%' . $wpdb->esc_like($this->table_search) . '%'
)
, ARRAY_A);
or
$form_data = $wpdb->get_results(
$wpdb->prepare(
'SELECT * FROM ' . $table . ' ucf WHERE name LIKE "'.$wpdb->esc_like($this->table_search).'"',
$this->form_active,
'%' . $wpdb->esc_like($this->table_search) . '%'
)
, ARRAY_A);
and search the full text without the % %
he thinks, does anyone know why?
I need a search that finds any part of the text and not only if the whole text is ...