Jump to content


Photo

Row Types


  • Please log in to reply
7 replies to this topic

#1 supanoob

supanoob
  • Members
  • PipPipPip
  • Advanced Member
  • 342 posts

Posted 10 June 2006 - 07:07 PM

well, anyway i want to be able to insert several things into one row.. like a list of items. now i dont know what type of field my items should go into. and i dont how i should update them. since a normal UPDATE script in php takes out whatever is in currently and replaces it with a new thing.

any help would be appreciated. thanks

#2 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 10 June 2006 - 08:17 PM

One row, or one column? Lists don't belong in single fields.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#3 supanoob

supanoob
  • Members
  • PipPipPip
  • Advanced Member
  • 342 posts

Posted 10 June 2006 - 08:31 PM

at the moment the field i want my items to go into is as follows,

field name: items
type: longtext
attributes: none
null: no
defaulth: none
extra: none

now, i was told that longtext would work for storing mulitple things in it. now what i want to do is put lets say 10 different things in it and when i echo it echo it as a list. but i dont know if all this is right or even possible and if so what would i need to put to add to the list of things in it?

would it be ADD to players blah='$blah' where user='$user' since i know update resets whatever your updating to its new value


#4 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 11 June 2006 - 03:13 AM

It's possible, but not desired -- you should have a separate row for each and every value of the "multiple".
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#5 supanoob

supanoob
  • Members
  • PipPipPip
  • Advanced Member
  • 342 posts

Posted 11 June 2006 - 04:20 PM

yes but then how would i know what row to put each item into?

#6 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 11 June 2006 - 05:38 PM

[!--quoteo(post=382542:date=Jun 11 2006, 12:20 PM:name=supanoob)--][div class=\'quotetop\']QUOTE(supanoob @ Jun 11 2006, 12:20 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
yes but then how would i know what row to put each item into?
[/quote]
I don't know what you mean -- if you're adding/deleting a item, you know which row it is; same if you're updating it. Each row would simply have a link back to the base table.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#7 supanoob

supanoob
  • Members
  • PipPipPip
  • Advanced Member
  • 342 posts

Posted 11 June 2006 - 08:41 PM

[!--quoteo(post=382561:date=Jun 11 2006, 12:38 PM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ Jun 11 2006, 12:38 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
I don't know what you mean -- if you're adding/deleting a item, you know which row it is; same if you're updating it. Each row would simply have a link back to the base table.
[/quote]


i got that part so what Type of row should it be? test, longtext?

maybe i should explain in a little more detail what i want to happen :S

ok so i want someone to be able to buy a weapon and an armour so they go to the shop. they buy the weapon (1 thing) its gets put into the item row (which at the moment is longtext) then they go to buy the armour and that takes over the weapon. but i dont want it too i want it to store both things in the row. then i want to be able to echo all the things in that row in a list like so.

Weapon
Armour
Weapon
Armour

i will even have 2 rows at one point splittin both things up.

#8 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 12 June 2006 - 04:53 PM

That's my point -- you don't want to store them both in one row. You want to store each in its own row, so they won't step one another.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users