I have a table called Friends are its fields are name, phone, address, skype, birthday and notes. There is also a search filed. How to search in all fields? Will something of this kind work for search word "Ana" and is there a better way?
$qb->select('f')
->from('Friends', 'f')
->where('f.name = :name')
->orWhere('f.phone = :phone')->orWhere('f.address = :address')-> ...
->setParameters( array(
'name' => 'Ana',
'phone' => 'Ana', ... ));
And I would also like to ask how to search for each word (something like fulltext search)? I mean if the user writes “Ana Ivan peter@domain.com” to receive all the row, which have in theirs fields (no matter in which field) Ana, Ivan and peter@domain.com.
For example if Ana and Ivan are the names of two of the friends, but the note for a friend, called John says “A friend of Ivan”, and Peter is the name of a friend with email peter@domain.com, the user should receive four rows – Ana, Ivan, John and Peter.
I’m not sure about this, but I think this may work