SQL Query Search page

Question

I am trying to create a WordPress webpage that has an input text box and a button. what I want to do is take the input text from the text box and use it as a parameter to search a table I put into the website database and print the results on the screen. I tried using PHP to no avail. what is the best to do this?
here is the code
Search the Film Database [php] global $wpdb; echo ‘Search’; $text = sanitize_text_field($_POST[‘input’]); echo $text; $wpdb->query(‘USE vcuw2938212664’); function myFunction(){ $txt = sanitize_text_field($_POST[‘input’]); echo ‘text is “$txt; $query = ‘SELECT * FROM documentaries WHERE English_Title = ‘%Li%’;’; echo $query; $results = $wpdb->get_results($query); if ($results != Null){ echo “{$results}”; } else { echo ‘no results returned’; } } [/php]

--------------------------------------------------

>>> Share a link to this question, just copy and paste the code bellow on your web page <<<

<a href="https://www.wptricks.com/question/sql-query-search-page/">

SQL Query Search page</a>
0
, , , user3533573 2 weeks 0 Answers 23 views 0

Leave an answer