Is there a code to make a search engine search by name?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
cloudplaya
Forum Newbie
Posts: 1
Joined: Wed Jul 04, 2007 9:41 pm

Is there a code to make a search engine search by name?

Post by cloudplaya »

Or any specific entity? like search by last name? All I see with PHP search engines are just strings and it brings up the page, I want to search just by name and it displays all the names such as ( Brad Johnson, Joe Johnson)?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

..but names are strings. :?
User avatar
undecided name 01
Forum Newbie
Posts: 12
Joined: Mon Jul 02, 2007 9:25 am
Contact:

Post by undecided name 01 »

Or any specific entity?
You can't search for an Entity, but for Entity Instances. We distinguish Entity Instances (Records/Rows in Tables) using their attributes' values, such as last/first names.

However, In case you're looking for the SQL-query to retrieve all names containing "johnson", here's the answer:

Code: Select all

SELCET * FROM People WHERE CONCAT(first_name, ' ', last_name) LIKE '%johnson%'
Post Reply