Connecting Tech Pros Worldwide Help | Site Map

Display table according to the search term

Familiar Sight
 
Join Date: Jan 2008
Posts: 198
#1: Mar 18 '08
In my application i have a table for retrieving database values. and also i have a search function. In page load in first time i want to display normal table and when searching i want to display only specific values according to the search term. Could you please tell me how can i do that?
Member
 
Join Date: Nov 2007
Location: Russia, Saint-Petersburg
Posts: 82
#2: Mar 18 '08

re: Display table according to the search term


Quote:

Originally Posted by ghjk

In my application i have a table for retrieving database values. and also i have a search function. In page load in first time i want to display normal table and when searching i want to display only specific values according to the search term. Could you please tell me how can i do that?

Try google for
Expand|Select|Wrap|Line Numbers
  1. php mysql
to find out basics. Or try to explain your problem more detailed.
Familiar Sight
 
Join Date: Jan 2008
Posts: 198
#3: Mar 18 '08

re: Display table according to the search term


Quote:

Originally Posted by satas

Try google for

Expand|Select|Wrap|Line Numbers
  1. php mysql
to find out basics. Or try to explain your problem more detailed.


I'm developing web application using php. one of my page hase 4 text boxes, search function and table.(teble displays database values). In first time user log in to this page he should display all values in the table. But if he search some value then should only display details accoring to that serch term.

EX. first time table has 5 record(default database values). Then he search by country(Search By: xxxx). So it should display 2 records those are in that country.

I want to load the value to same table in both situation.
Member
 
Join Date: Nov 2007
Location: Russia, Saint-Petersburg
Posts: 82
#4: Mar 18 '08

re: Display table according to the search term


Okay, but it is a quite typical application described in the most of tutorials.
All you need to do is to execute 2 queries and display the results:
Expand|Select|Wrap|Line Numbers
  1. SELECT * FROM `table_name`;
and
Expand|Select|Wrap|Line Numbers
  1. SELECT * FROM `table_name` WHERE `country`='country_name';
Reply