/    Sign up×
Community /Pin to ProfileBookmark

increase table value?

hey,

I hope this makes sense so heres my quesion. Im working on a rating script cause im bored and im working on adding the part where you can pick your rating on a scale 0-5. and my table is set up with rate_0 – rate_5. pretty much i stick the number of votes for each value in each one. i know i can get the value out of the table and put it as a variable. then in another variable add +1 to that number, then run an update query to resubmit the new number. is there a way i can just add +1 to the appropriate row without having to get it out and put it back in?

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@SpectreReturnsFeb 17.2006 — I'm far from a SQL expert, but I seriously doubt it.
Copy linkTweet thisAlerts:
@chazzyFeb 17.2006 — umm yes.

<i>
</i>UPDATE your_table SET the_column_they_voted_for = the_column_they_voted_for +1;


and if i could be so blunt as to say, why are you keeping each value in a separate column?
Copy linkTweet thisAlerts:
@SpectreReturnsFeb 17.2006 — And thus we learn, I'm not an SQL gosu.
Copy linkTweet thisAlerts:
@chazzyFeb 17.2006 — And thus we learn, I'm not an SQL gosu.[/QUOTE]

I am not a gosu either, I think....

?
Copy linkTweet thisAlerts:
@welshauthorFeb 17.2006 — yeah, i now realised the way i did it doesnt much sense where i could condense it down to 3 columns, o well. learned that the hard way :p
×

Success!

Help @welsh 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 5.18,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...