Do you want to say you want to extract data from database which met with some condition? if yes then you can do it like following : $result = mysql_query(select name from tablename where salary > 2000 and age <30); above query will return name of all persons whose salary is more then 2000 and age is less then 30. Sheetal