Welcome Guest, Not a member yet? Register   Sign In
Setting event using a date, not a day in every month?
#4

[eluser]gtech[/eluser]
Code:
// Create array of days with content

    function createEvents($query) {
        $events = array();
        foreach($query->result_array() as $row) {
            $curDay = $row['event_Bday'];
            while($curDay < $row['event_EDay']) {
                $curDay++;
                $events[$curDay] = $row['user_id'];
            }
        }
        return $events;
    }

I'll put my pennies worth in..



think as you are using arrays to access the query result you should be using $query->result_array();

you need to default the events array in case nothing is returned and also you were also overwriting the events array (not sure that was desired behavior?)

I have tried to do a fix see above but it is untested.

another tip, if your debugging use echo and print_r to display variables (you can take them out when it works)

e.g.

Code:
...
  ...
  while($curDay < $row['event_EDay']) {
    $curDay++;
    $events[$curDay] = $row['user_id'];
    echo "Current Day:".$curDay."<br>";
    echo "Events Array<br>";
    print_r($events);
  }
  ...
  ...


Messages In This Thread
Setting event using a date, not a day in every month? - by El Forum - 11-01-2007, 05:00 AM
Setting event using a date, not a day in every month? - by El Forum - 11-01-2007, 05:32 PM
Setting event using a date, not a day in every month? - by El Forum - 11-02-2007, 08:52 AM
Setting event using a date, not a day in every month? - by El Forum - 11-02-2007, 11:48 AM
Setting event using a date, not a day in every month? - by El Forum - 11-02-2007, 01:35 PM



Theme © iAndrew 2016 - Forum software by © MyBB