Jump to content

Recommended Posts

well i need a query that #'s a members products ion order from 1-2-3....
my tables look like this
[code]
Members:
Username      email       password
____________________________
saad           --------       -----------
darkness     --------       -----------

Products:

Product     slot      id          owner
___________________________
........        1        ..         saad
........        3        ..        saad
.........       9        ..         saad
........        1        ..        darkness
[/code]

what i need to do is update the table so all the products owned by 'saad' are # 1-2-3... in numerical order in the row 'slot' i cant use auto_incretement becaue i only want to # products owned by'saad' and for the other user his products will also start from 1

i can get them to insert by using slot=slot + 1
but the problem is sometimes they get ot of place and some #'s are skipped so if any1 can help me with that id appreciate it alot
Link to comment
https://forums.phpfreaks.com/topic/8009-ing-in-order-on-click/
Share on other sites

[!--quoteo(post=367089:date=Apr 20 2006, 11:26 PM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ Apr 20 2006, 11:26 PM) [snapback]367089[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Well, you know that you can have a auto-increment that is part of a multi-colum index, right? This allows you to do exactly what you're trying to achieve: ordered groups.
[/quote]

umm not sure how to set that up can you maybe detail a little bit and will it work if like the slots get mixed up the person can just click a link that executed the query and they get reset?
Link to comment
https://forums.phpfreaks.com/topic/8009-ing-in-order-on-click/#findComment-29422
Share on other sites

[!--quoteo(post=367293:date=Apr 21 2006, 04:08 PM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ Apr 21 2006, 04:08 PM) [snapback]367293[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Take a look [a href=\"http://dev.mysql.com/doc/refman/5.0/en/example-auto-increment.html\" target=\"_blank\"]here[/a] -- this will auto-number.
[/quote]

yea i saw that i know that part but what if the product is exchanged with another user and the slots stay the same how would i do it so it renumbers it self according to the users slots already used
Link to comment
https://forums.phpfreaks.com/topic/8009-ing-in-order-on-click/#findComment-29501
Share on other sites

[!--quoteo(post=367418:date=Apr 22 2006, 02:09 AM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ Apr 22 2006, 02:09 AM) [snapback]367418[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Yeah, that won't happen on it's own. I must ask why you need to store this slot number -- are you actually using this as some sort of sortorder? If so, they don't have to be sequential, they just have to be larger than the previous one.
[/quote]

umm no lol im making my own rpg which kinda uses the same concept but i need slots so they show in order and people can do stuff with them and if they exhange items/product the slot #s reoder for the person starting from one and i can't use auto_incretement because im already using it for ID and i can only have it once in a table i think

any ways i was looking for something more script wise

that counts the users items/products and than #'s the slots

you probably wont get what i mean but try checking out the website you might get what i mean

[a href=\"http://Http://tpfmail.byethost32.com\" target=\"_blank\"]Http://tpfmail.byethost32.com[/a]

login info:
username:guest
password:guest

umm and i have 1 more question but i prefere talkiing using MSN IM if you do have an account plzz. add me pakiboi44@hotmail.com
Link to comment
https://forums.phpfreaks.com/topic/8009-ing-in-order-on-click/#findComment-29612
Share on other sites

Let's keep the discussion to the forums so other can contribute.

All I meant was that if you're generating a sequence, you can do this "on the way out" -- no need to store it and maintain it constantly in the DB. However, if this is a "sortorder", where you're showing a list that the user can sort, and you want to maintain this order across "sessions", then you will need to store it. Though if this is the case, you'd be saving it every time anyway, and you wouldn't have a problem.

Does this make sense?
Link to comment
https://forums.phpfreaks.com/topic/8009-ing-in-order-on-click/#findComment-29623
Share on other sites

[!--quoteo(post=367489:date=Apr 22 2006, 01:18 PM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ Apr 22 2006, 01:18 PM) [snapback]367489[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Let's keep the discussion to the forums so other can contribute.

All I meant was that if you're generating a sequence, you can do this "on the way out" -- no need to store it and maintain it constantly in the DB. However, if this is a "sortorder", where you're showing a list that the user can sort, and you want to maintain this order across "sessions", then you will need to store it. Though if this is the case, you'd be saving it every time anyway, and you wouldn't have a problem.

Does this make sense?
[/quote]

umm makes sense but this is whats happening right now

All creatures have slots
you can carry a max of 6 at a time
the 6 you creatures with slots(1,2,3,4,5,6)
But than you can change creatures which you want to carry i have made a query for that which just switches the slots
but than there is trading you can trade your creatures for others so this is where it gets messed up when u trade the slots are not in order anymore so you're data doesnt get stored properly and cant be viewed properly

so what i was looking for is something that will
after trading
renumber all of the users creatures from 1-(total creatures)

( i am using creatures to make it sound like what im using it for)
Link to comment
https://forums.phpfreaks.com/topic/8009-ing-in-order-on-click/#findComment-29631
Share on other sites

[!--quoteo(post=367500:date=Apr 22 2006, 02:13 PM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ Apr 22 2006, 02:13 PM) [snapback]367500[/snapback][/div][div class=\'quotemain\'][!--quotec--]
I understand. You can definitely issue a query that will renumber them; I guess my question is why you are numbering them to begin with. You can enforce for maximum of 6 slots in your app logic -- why have the slot number stored at all?
[/quote]

because users can have alot of creatures like 1000 and if they want to change the carried ones they can switch the slots and there is some other stuff they will need them for like battle i can't explain everything lol
Link to comment
https://forums.phpfreaks.com/topic/8009-ing-in-order-on-click/#findComment-29638
Share on other sites

[!--quoteo(post=367527:date=Apr 22 2006, 06:01 PM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ Apr 22 2006, 06:01 PM) [snapback]367527[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Still... you can use a flag to mark the ones that are currently "active", instead of playing this renumbering game.
[/quote]

umm true but accept you dont recieve all you're creatures at signup you have to catch so it wouldnt work with marking using flags so id much rather prefere renumbering do u have any idea how i can acheieve this?

o and im having trouble with making a query that fetches a row and if the row doesnt exsist it echos "none" it's used for a picture so if the result is not found it shows a default picture named none and if it is found it shows the result
Link to comment
https://forums.phpfreaks.com/topic/8009-ing-in-order-on-click/#findComment-29667
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.