rhysmeister Posted May 30, 2003 Share Posted May 30, 2003 This is the SQL statement I am using to search an entire DB table for a keyword SELECT * FROM faults WHERE company OR date OR user OR product OR version OR issue OR resolution OR comment OR resolved_by LIKE \'%$keyword%\'; The problem is that is pulls out all entries whatever is input. I have echoed $keyword on to the web page and all seems OK there. I also entered the statement into the mysql console and the same result occured, so I guess there\'s something wrong with the statement. Any ideas? Link to comment https://forums.phpfreaks.com/topic/528-sql-searching-an-entire-db-for-a-keyword/ Share on other sites More sharing options...
shivabharat Posted May 30, 2003 Share Posted May 30, 2003 Try this :roll: SELECT * FROM faults WHERE company LIKE \'%$keyword%\'OR date LIKE \'%$keyword%\' OR user LIKE \'%$keyword%\' OR product LIKE \'%$keyword%\'OR version LIKE \'%$keyword%\'OR issue LIKE \'%$keyword%\' OR resolution LIKE \'%$keyword%\' OR comment LIKE \'%$keyword%\' OR resolved_by LIKE \'%$keyword%\'; Link to comment https://forums.phpfreaks.com/topic/528-sql-searching-an-entire-db-for-a-keyword/#findComment-1776 Share on other sites More sharing options...
rhysmeister Posted May 30, 2003 Author Share Posted May 30, 2003 Thanks! Link to comment https://forums.phpfreaks.com/topic/528-sql-searching-an-entire-db-for-a-keyword/#findComment-1777 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.