Jump to content

Search feature


ainoy31

Recommended Posts

I have a search option on my webpage where users enter someone's first and last name and click in the search button.  If the record is found in the database, the record data will be displayed else return an error message.  Instead of typing the full first and last name such as Olivia True, I want to just enter the first three letters for the first and last name.  Should I use a wildcard character or what is the best way to handle this?  Much appreciation.

 

thx.

 

AM

Link to comment
https://forums.phpfreaks.com/topic/55141-search-feature/
Share on other sites

try the like function using % as a wildcard, alternatively to the % if u know how many extra letters there is than 3 u could use undscore (each underscore represents another letter so if i search for oli___ it would show olivia:

$sql = mysql_query("SELECT * FROM table_name WHERE columnname LIKE value%"); 

Link to comment
https://forums.phpfreaks.com/topic/55141-search-feature/#findComment-272611
Share on other sites

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.