The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Adding together with PHP...
Sounds silly, but anyway...
I have 4 fields in the user table, score1,score2,score3 and score4... These store the scores from each stage of a test I make the user's take... Anyway, I want to know how to add the contents of the fields together (also what field types I would need), so that the following will work: Code:
$total = $DB_site->query("SELECT score1,score2,score3,score4 FROM user WHERE userid='$bbuserinfo[userid]'"); $addingup = "ADDING UP BIT"; $totalscore = "THE RESULT"; if ($totalscore<=6) { $group=='9'; }elseif ($totalscore>=7 AND $totalscore<=10) { $group=='11'; }elseif ($totalscore>=11 AND $totalscore<=13) { $group=='10'; }else{ $group=='8'; } $usergroupname = $DB_site->query("SELECT * FROM usergroup WHERE usergroupid='$group'"); $DB_site->query("UPDATE user SET usergroupid='$group' WHERE userid='$bbuserinfo[userid]'"); Edit: Extra Info - There are 4 questions, each with 4 possible answers, which are assigned a point value from 1 to 4, 4 being the highest and "best" answer, 1 being the lowest and "worst" answer (as such) Satan |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|