Jump to content

some help please


advo

Recommended Posts

hi  i have been having a issue that for life of me just isnt sitting in my head right

 

i have a table called `ranks` with a persons `userID` and various ranks inside it like income whatnotthis table holds there main rank under field `rank`

 

there userinformation is help in `userdeatials` i added a fields called `glorypoints`

 

now what im trying to do is if say there rank is below between 1- 10 give them 2 glory points if 11-50 give them 1

and those above that get nothing

 

now this is what i have and it dose not update the proper parts of table ie rank 1-50 every one is getting them 

 

this is the code im using\

 

UPDATE userdetails SET glorypoints = glorypoints+'2' WHERE rank > 11 AND rank < 50 AND ranks.userID=userdeatils.ID

 

 

Link to comment
https://forums.phpfreaks.com/topic/229680-some-help-please/
Share on other sites

you are refering to a table rank  "AND ranks.userID=userdeatils.ID" but you have not have joined it

 

so off the top of my head:

 

UPDATE userdetails Inner Join rank On rank.userID = userdeatils.ID

SET glorypoints = glorypoints+'2' WHERE rank > 11 AND rank < 50 AND ranks.userID=userdeatils.ID

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/229680-some-help-please/#findComment-1183568
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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