MySQL result printing in for-loop

Discussion in 'PHP' started by onlyleif, Jul 24, 2007.

  1. #1
    I have a script that count and print every week in a selected year.

    Now i want to connect this to the returned result from a MySQL query.

    Code to explain what I am trying to accomplish:



    // $number_weeks = weeks in chosen year

    for($i = 1;$i <= $number_weeks;$i++)
    {
    $row = mysql_fetch_array($result);
    if ($row['week'] == $i)
    {
    echo "Exsisting in database!";
    }
    }
     
    onlyleif, Jul 24, 2007 IP
  2. onlyleif

    onlyleif Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Fixed the problem
     
    onlyleif, Jul 24, 2007 IP
  3. HuggyCT2

    HuggyCT2 Guest

    Messages:
    222
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Maybe you can share with others? Helps some people out who may have the same troubles.
     
    HuggyCT2, Jul 24, 2007 IP