Search bar, Not working?

So, I followed a tutorial on youtube = Creating a PHP Search by TheHelpingDevelop

This is the 10th Tutorial I have now followed, I can not understand whats going wrong, Please help

My table name is = avatar_list
the two fields im trying to bring out are
solution (I am not trying to search this field)

I am only trying the search the name column


<? include_once (""); $output = ''; if(isset($_POST['search'])) { $searchq = $_POST['search']; $query = mysql_query("SELECT * FROM avatar_list WHERE name LIKE '%searchq%'") or die("could not search"); $count = mysql_num_rows($query); if($count == 0) { $output ='No search results'; }else{ while($row = mysql_fetch_array($query)) { $name = $row['name']; $solution = $row['solution']; $output .= ''.$name.' '.$solution.''; } } } ?>


Seach for: <?php print("$output");?>


This script is bringing nothing back for me, i get

No search results

So, Can someone help me, where am I going wrong

(My db connection is in my

3 things.
1 - does the server allow short tags? (<? instead of <?php), most hosts don’t by default.
2 - you’re not referencing a variable in the query, just have %search%. If search is a variable, you need to have %$search% instead.
3 - is that php in form.php or on top of the search page?

Sponsor our Newsletter | Privacy Policy | Terms of Service