If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Integration data retrieved via webservice query with my own database

Hello,

I have a website that allows users to search stuff in my database via a web interface.

Now I have the possibility to get more such data from external sources. I also query data from remote servers by consuming web services when the user searches for something. Now I want to list search results from both the data in my database and the external data I retrieve from the web services on the webpage if a user searches for something.

I need to order all the data by price and various other properties, so I want to get the external data into my database as well, but only temporary to answer the a user's query of course (it could change on the remote server any time and thus become invalid if it is too old).

What is the best way to store the external data in a way that allows searching and ordering it quickly and easily?

If the sorting is not too terribly complex and you're not talking about too much data (for some undefined value of "too much"), you could just load everything into an array of arrays, and use usort() to sort it as needed. If it's going to be a lot of data (for some undefined value of "a lot"), the temp table strategy might be better, making use of the efficiency of the DBMS's sorting abilities to offset the cost of having to insert that external data into it and then pull it out again (sorted).

The stuff in my database alone is several thousands of records and growing, but the data I get via the web service should be much less (it is from a single company and already restricted to the query parameters).

So maybe I could really just get the best 20 or so from my DB, using its sorting capabilites. The merge with the little data I get from web services and sort again. I'll give it a try, thanks for the suggestion.