Collegeboox Posted October 21, 2011 Share Posted October 21, 2011 I am trying to have a search bar and this is the search results page. However when they search they have the option to type in anything and it will search the entire directory for what ever they type in so if they type in "Dog" I want dog to be searched for in the database under title and author this is the code I have now...can anyone help me?? // Build SQL Query $query = "select * from videos where title like \"%$trimmed%\" order by id DESC"; // EDIT HERE and specify your table and field names for the SQL query Quote Link to comment https://forums.phpfreaks.com/topic/249538-php-grabbing-from-database-this-or-that/ Share on other sites More sharing options...
ManiacDan Posted October 21, 2011 Share Posted October 21, 2011 $query = "select * from videos where title like \"%{$trimmed}%\" or author like \"%{$trimmed}%\" order by id DESC"; // EDIT HERE and specify your table and field names for the SQL query Quote Link to comment https://forums.phpfreaks.com/topic/249538-php-grabbing-from-database-this-or-that/#findComment-1281149 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.