Jump to content

API and DB best practice query


twsowerby

Recommended Posts

Hi Guys,

 

I have a query regarding best practice for performance on a web application I'm developing.

 

I am retrieving data via an API that I then need to display on a website.

 

The data retrieved all relates to a product ID. The issue I am having is that each product has a UniqueID, but also a GroupID. The GroupID is used to display the same products but of different colour/size combinations.

 

ie.

 

UniqueID

GroupID

Size

Colour

1

1

n/a

n/a

2

2

Small

Red

3

2

Medium

Blue

4

2

Large

Green

 

I need to display the products in a list, but where there are multiple products in a group, I need to provide a dropdown selector for size and a dropdown selector for colour.

 

I'm struggling a bit with how to structure it with just the array spat out by the API, so I was considering saving the data to a MySQL database and then querying that to get what I need.

 

Is this a good way to go or is the double query hit going to be horribly inefficient?

 

Cheers!

Link to comment
https://forums.phpfreaks.com/topic/260311-api-and-db-best-practice-query/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.