Announcement

Collapse
No announcement yet.

Yet Another PHP Issue, calender this time

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Yet Another PHP Issue, calender this time

    PHP Dudes,

    If any of you are at a loss today I could do with some help with this little problem.

    In the third section of the code I want to test every entry against an array. In the forth section I just use a for loop to loop the testing array, this however doesn't work for the third section.

    The loop only ever works in the fourth section in fact, anyone know how I can get the testing working for the main part of the calender, giving me quite a lot of trouble yesterday.


  • #2
    You seem to be missing this line from section 3 just above the commented out for loop:
    $row_rCalData = reset($row_rCalData);

    Might be completely off there as I had some trouble following the code
    Last edited by Rob(QG); 11 January 2005, 12:20.

    Comment


    • #3
      Originally posted by Rob(QG)
      Might be completely off there as I had some trouble following the code [/B]
      Same here , tried adding in the array reset(), still won't work, just seems to be that middle section.

      Comment


      • #4
        OK, take two,

        Got this simple test.

        Code:
        if(($DayTest >= $row_rCalData['SDate']) AND $DayTest <= $row_rCalData['EDate'] {
          $class = "booked";
        } else {
          $class = "day";
        }
        Problem is I need to test this against an array.

        1 => 2005-01-10 ... 2005-01-14
        2 => 2005-01-16 ... 2005-01-18

        Tried the following but it doesn't seem to work, well not all the time anyway.

        Code:
        for ($i=0;$i<$rows_rCalData;$i++) {
        if(($DayTest >= $row_rCalData['SDate']) AND $DayTest <= $row_rCalData['EDate'] {
          $class = "booked";
        } else {
          $class = "day";
        }
        }
        How do I go about doing this check on an associative array??
        Last edited by dbdg; 11 January 2005, 15:50.

        Comment


        • #5
          Think I have solved it for now.

          Code:
                for($a=0;$a<2;$a++) {
                 mysql_data_seek($rCalData, 0);
                 for($i=0;$row_rCalData=mysql_fetch_assoc($rCalData);$i++) {
                  $SDate = $row_rCalData['SDate'];
                  $EDate = $row_rCalData['EDate'];
                  echo $SDate . " - " . $EDate . "<br />\n";
                 }
                }
          btw, I am practising to be a post whore.
          Last edited by dbdg; 11 January 2005, 17:35.

          Comment


          • #6
            You're doing quite well!
            _____________________________
            BOINC stats

            Comment

            Working...
            X