svgmx5 Posted April 28, 2010 Share Posted April 28, 2010 Does anyone know how i can make a query for a keyword (say apple) in different field? Example would be... I have 4 fields in my database field 1, field2 field 3, field 4 each field has different keywords, apple, banana, orange, strawberry What i want to do is make a query with php were it searches for say apple, but it searches all 4 fields to see in which field apple is at Does that make sense? Could i do the following... <?php $sql = "SELECT * FROM table WHERE field2='1' || field2='1'"; ?> Link to comment https://forums.phpfreaks.com/topic/200034-search-more-than-1-field-in-mysql-database-for-a-keyword/ Share on other sites More sharing options...
Ken2k7 Posted April 28, 2010 Share Posted April 28, 2010 Change || to OR. Link to comment https://forums.phpfreaks.com/topic/200034-search-more-than-1-field-in-mysql-database-for-a-keyword/#findComment-1049901 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.