Best way to save furniture in mysql for house decoration?
#1

I've recently been trying to find a way for players to decorate their house and the objects save to their house... problem is... i'm trying to figure out the best way to save it to MySQL... I planned to sell it in the 'House' table where the houses are all saved... I just don't know how I could come around it other than this idea which i'll explain now:

Make one column called 'Furniture' and every furniture that is placed in the house will be stored to that column, then if the server restarts loop through the index of furniture for that house and then add the furniture to the house then move onto the next one?

This is my only idea but seeing as I at least had one I thought i'd throw it out to you.. is that the best way to do it? Or does anyone have any better suggestions?
Reply
#2

Finally a topic that someone seems like they actually want to TRY to do something in! Thank you, you'll be getting a +rep from me!

Anywhore, back on topic. As far as storing them into a single field on the row for the house... that's a bad idea. A VERY bad idea. I think you'll find this one much more appealing:

A new table called "houseFurniture" that has the following fields:

furnitureID
houseID
objectModel
objectX
objectY
objectZ
objectRX
objectRY
objectRZ

The "furnitureID" should be an auto-increment fields. The "house ID" should correspond with the house ID in your "Houses" table. Each new object has it's own row, with it's own ID, and that ID corresponds to the house so if you want to delete a house, you can delete the furniture for the house, too!
Reply
#3

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
Finally a topic that someone seems like they actually want to TRY to do something in! Thank you, you'll be getting a +rep from me!

Anywhore, back on topic. As far as storing them into a single field on the row for the house... that's a bad idea. A VERY bad idea. I think you'll find this one much more appealing:

A new table called "houseFurniture" that has the following fields:

furnitureID
houseID
objectModel
objectX
objectY
objectZ
objectRX
objectRY
objectRZ

The "furnitureID" should be an auto-increment fields. The "house ID" should correspond with the house ID in your "Houses" table. Each new object has it's own row, with it's own ID, and that ID corresponds to the house so if you want to delete a house, you can delete the furniture for the house, too!
Well thank you very much for the +rep. I always try to figure something out myself before coming here but I just for some reason couldn't work it out and yet looking at your way... All I can do is bring my hand to my face and say... Why didn't I think of that originally...

Yup, that makes perfect sense, I'll link it to the house ID which I have in my house table. Brilliant! I'm going to get to work on it now, thank you very much RealCop. It's very much appreciated for your helping hand.
Reply
#4

I'm here to help .. sort of!

I'm giving you special permission to PM me for any issues you have in the future relating to scripting. I have been working with MySQL for like 3-4 years now, I'm quite skilled in it for the most part. Especially since I've just written an evasive system for one of my servers that has quite a few interesting queries.
Reply
#5

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
I'm here to help .. sort of!

I'm giving you special permission to PM me for any issues you have in the future relating to scripting. I have been working with MySQL for like 3-4 years now, I'm quite skilled in it for the most part. Especially since I've just written an evasive system for one of my servers that has quite a few interesting queries.
Woah thanks very much indeed bro! Yeah I've only been using MySQL for around about a year now... before I used dini (ugh) worse saving system to use nowadays in my own opinion, i'll definitely drop you a few questions in the nearby future! Thanks again
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)