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!
I have a a table named "clients" and has the attributes of "type_company" "company_name" these are the attributes that the user will search for when looking for a client.
So I have created a form with a input text box that allows the user to enter what the want to search like they will type a company name that links to the company_name attribute. And alos a submit button.
But what I need to know is how to create a search tool that will search the name entered in the text box in the client table when the submit button is pressed. And when found in the database it will bring all the information stored on that clients name to the form for the user to view or edit if they wish. And when its not found it will give a message that the client does not exist and to choice another one.
I hope someone can help me with this I would be really greatful
that's a basic SELECT query with a LIKE term used. You check how many rows found: zero, display your 'none found' message; one, display that record; more than one, display a list to choose from.
Yes, and you may take a look at some mysql wild cards like %, ^, _ etc. to fit your needs.
Further more, if you're going to search for a string ($keyword) you may interest in highlighting it in the returned paragraph by