i want to store data into database at a time i have to compare the data with alredy existed data how to do this using php

First fire the select statement using where clause and assigning some values for which you want to compare the records in the database.
If you get 0 records or Null dataset, it means there is no such data in the database.
If you get more than 0 records, the you can compare the records with your values

Database is an integrated collection of logically related records or files which consolidates records into a common pool of data records that provides data for many applications. Its a free distribution, free source, low overhead and secure.