0
I have a search in wordpress and she 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 so, but if I put what I want to seek in this way:
        $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 % % Does he think, does anyone know why ?
I need a search that finds any part of the text and not only if the whole text is...
check the function return
$wpdb->esc_likehe must be coming with%– Guilherme Lautert
is not coming with
%No, if I leave without the%it searches but only the whole text...– Alan PS