Retrieving values from database

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
Manoj Kumar
Forum Newbie
Posts: 8
Joined: Thu Jan 12, 2012 6:00 am

Retrieving values from database

Post by Manoj Kumar »

Hi all... I'm trying to create one web portal... For that i've a database which contains a field called comp_name and am trying to retrieve the values stored in that field in a text box using ajax autocomplete. I've a value which is repeated twice in the comp_name field and i would like to display that value only once to the user. How can i do this ?? help me out..
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Retrieving values from database

Post by Celauran »

Add a limit clause to your query?
Manoj Kumar
Forum Newbie
Posts: 8
Joined: Thu Jan 12, 2012 6:00 am

Re: Retrieving values from database

Post by Manoj Kumar »

I'm new to php and mysql concept. Here is my query

SELECT * FROM customer_tb WHERE comp_name LIKE '$str%' and status = '1'

What changes do i need to do ?
Manoj Kumar
Forum Newbie
Posts: 8
Joined: Thu Jan 12, 2012 6:00 am

Re: Retrieving values from database

Post by Manoj Kumar »

It's working . Thanks for the help .
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Retrieving values from database

Post by Celauran »

If you only need comp_name, replace SELECT * with SELECT comp_name
Post Reply