Connecting Tech Pros Worldwide Forums | Help | Site Map

Mysql query for search

Familiar Sight
 
Join Date: Mar 2007
Posts: 172
#1: Sep 25 '09
HI all,
I have a small job posting application. For that i have seven fields in 'joblist; table
1. job title
2. des
3. company name
4. contact number
5. Email
6. Posted date.
7. Userid

What i did is, i listed all the jobs according to the user login in back end. For more clear when user 1 is logged into adminpanel then he can able to see her/him post. for this i did this query

select * from joblist where uid='$uid'

This is working fine, but i have a search text box on that. when user type any search word and hid the submit means it will search the whole table which contains the search text for specified user id. for example if am entered the search text 'test', then i would search select * from $table_name where eid='$eid' and (search * from joblist where uid='1' and job_title = 'text' || job_des='test' upto all fields..)

For this how i can simple by this query....

I want to search the the text 'test' to whole table(this will check all fields with the condition of where uid='$uid' like ( select * from joblist where each_field_name like %test% and uid='$uid')

ssnaik84's Avatar
Member
 
Join Date: Aug 2009
Location: Bengaluru, India
Posts: 122
#2: Sep 25 '09

re: Mysql query for search


if you really want to fetch column names dynamically.. check this

but it will make the things complex.. and cost of your query will be high...
Reply