plugins – Search the database with WPDB using a php variable

I'm trying to create a basic search function for the database of my website. I want to search the text content in a custom database table with the help of WordPress and WPDB.

For some reason, the search returns nothing from the database, but I also do not receive an error message. Here is my code:

thePage.php:

functions.php:

search_cv () function
{
// retrieve the search query
$ search_text = ($ _POST["search_text"])

// clean that
$ search_text = sanitize_text_field ($ search_text);

// ... do stuff with that
global $ wpdb;

$ result = $ wpdb-> get_results ($ wpdb-> prepare ("CHOOSE b, c, v, t FROM myTableName O t like% s", $ search_text), ARRAY_A);

// display the HTML code that will be used by $ .html ()

?>
you searched and we found ... t; } ?>
<? php // stop doing things die(); } add_action (& # 39; wp_ajax_search_cv & # 39; & # 39; search_cv & # 39;); add_action (& # 39; wp_ajax_nopriv_search_cv & # 39; & # 39; search_cv & # 39;);

I suspect the error is in my use of $ wpdp-> prepare or SQL query, but I have no idea what could go wrong here.