Page 1 of 1

Retrieving values from database

Posted: Mon Jan 30, 2012 9:22 am
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..

Re: Retrieving values from database

Posted: Mon Jan 30, 2012 9:30 am
by Celauran
Add a limit clause to your query?

Re: Retrieving values from database

Posted: Mon Jan 30, 2012 9:39 am
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 ?

Re: Retrieving values from database

Posted: Mon Jan 30, 2012 9:45 am
by Manoj Kumar
It's working . Thanks for the help .

Re: Retrieving values from database

Posted: Mon Jan 30, 2012 9:48 am
by Celauran
If you only need comp_name, replace SELECT * with SELECT comp_name