PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Not that it will help alot, but if every tiny iddy-bitty bit counts...
Including a file costs more performance-wise than inline code, so instead of including fetch_query.php, you could duplicate its code here.
Doing a select * fetches all fields, but you might not need them all. It is more efficient to say select field1, field2, etc listing only the fields you want.
It also looks like you store the colors in your database in one format, then pull them out and convert them to some other format. It would be optimal to store them in your database in the same way you intend to use them so you don't have to retranslate the same record over and over.
None of these amount to much individually, and I doubt it'll even be noticeable collectively. But that's what I saw.