Jump to content

search more than 1 field in mysql database for a keyword


svgmx5

Recommended Posts

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'";
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.