how do i increment inside a loop?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • blade_in_exile
    New Member
    • Aug 2006
    • 12

    how do i increment inside a loop?

    initialize a var to 1 outside of your mysql_fetch_arr ay() loop. Then, within the mysql_fetch_arr ay() loop, use the var as necessary and increment it by 1
  • iam_clint
    Recognized Expert Top Contributor
    • Jul 2006
    • 1207

    #2
    you do it exactly as you said :P

    var = 1
    loop
    var = var + 1
    data
    end loop

    Comment

    • ronverdonk
      Recognized Expert Specialist
      • Jul 2006
      • 4259

      #3
      Am I missing something here? What was the question?

      Ronald :cool:

      Comment

      • blade_in_exile
        New Member
        • Aug 2006
        • 12

        #4
        ok maybe not clear in what i wanted

        i have this
        $pos=1
        where do i put the loop in this
        ($row = mysql_fetch_arr ay($result, MYSQL_ASSOC))

        Comment

        • iam_clint
          Recognized Expert Top Contributor
          • Jul 2006
          • 1207

          #5
          $pos=1
          while ($row = mysql_fetch_arr ay($result, MYSQL_ASSOC))
          $pos=$pos + 1

          Comment

          • blade_in_exile
            New Member
            • Aug 2006
            • 12

            #6
            thank you iam_clint i had trouble putting it wher i wanted it at first then put it in the correct place in place of $row[$pos]

            thank you again

            Comment

            Working...