Jump to content


Photo

Manipulating table data


  • Please log in to reply
3 replies to this topic

#1 jd|

jd|
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 23 July 2006 - 01:46 PM

Hi I’m creating a site for my golf society and I have come to a stand still and am unsure on how to continue.

I have a form that inputs a score for each member this is recorded in a table along with the course id. When all the data is entered I need to adjust everyone’s handicap based on certain rules the handicap is stored in a different table. i.e

· The winnings handicap has 2 strokes deducted from their handicap
· Anyone with more than 36 points has 0.5 deducted from their handicap
· Anyone three points below the winner will receive 0.1 onto their handicap
· Anyone six points below the winner will receive 0.2 onto their handicap.

The problem is I think I can write the “if else” statements to cover all the eventualities but I have no clue on how to loop the data through the loop.

Any help would be greatly appreciated.

JD


#2 jd|

jd|
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 24 July 2006 - 03:38 PM

Anyone have an suggestions ?

JD


#3 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 24 July 2006 - 04:19 PM

This is in a database, right?

If so, you can update with SQL statements:

$query = "UPDATE scoring_table SET handicap = handicap + .1 WHERE userid = x"

Info: PHP Manual


#4 jd|

jd|
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 24 July 2006 - 05:27 PM

Yes its mysql. But the problem I have is the query to excute all the members table one after each other  and the if events for this




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users