I am working on a Minecraft website project. I have a table in the database with the in game data value for blocks(only ones that cannot be crafted). I want to have a separate table for those which can be crafted in to things like Pistons. How would I be able to do a query where it will return all craft recipes that have cobblestone as an example? I was thinking of an array but unsure how it would work
Thanks
Difficult one
Re: Difficult one
How is the table layed out?
if all materials needed are in a single field then use like and the wildcard
if all materials needed are in a single field then use like and the wildcard
SELECT * FROM recepies WHERE materials LIKE "%cobblestone%"if each material has its own field then you could do something like
SELECT * FROM recepies WHERE material_1 = "cobblestone" OR material_2 = "cobblestone" etc....Thats how i would query it, but no doubt there is a better way lol.
Last edited by jacek on Thu Sep 08, 2011 11:11 pm, edited 1 time in total.
Reason: code tags...
Reason: code tags...
Re: Difficult one
Torniquet wrote:How is the table layed out?
if all materials needed are in a single field then use like and the wildcard
SELECT * FROM recepies WHERE materials LIKE "%cobblestone%"
if each material has its own field then you could do something like
SELECT * FROM recepies WHERE material_1 = "cobblestone" OR material_2 = "cobblestone" etc....
Thats how i would query it, but no doubt there is a better way lol.
Thanks, but what happens if someone queries stone and it returns cobblestone. I'm sure there will be a way to do it more specific