/    Sign up×
Community /Pin to ProfileBookmark

Need help finding an elements position in a query?

basically, I’m trying to create a script to set the priority of an item which is used to sort the query. So not only does the element who triggered the function have to change, but so do all the other values too. I’m having a rough time wrapping my head around it. The more I try to go through the process the more obstacles I see.

for example
P id (P=priority)
1 a { everything between here is uneffected
2 b }
3 c {
4 d everything between here is incremented
5 e }
6 f <= say I want f to be Priority 3
7 g {
8 h
9 i everything here is decremented
10 j
11 k }

order of events:
1. find the pointer position of the record that triggered the function.
2. set pointer to next record (if exist) and decrement..repeat
3. set pointer to the requested priority (3) and increment till the current priority (6)
4. set priority of id f

Is my logic here correct?
What functions would I use to acheive this?

to post a comment
PHP

0Be the first to comment 😎

×

Success!

Help @coolguy00777 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...