Welcome Guest, Not a member yet? Register   Sign In
Date function not working on the server
#1

[eluser]Unknown[/eluser]
for some reason the Php date isn't working on the server.

Here is the function for displaying the tip of the day. I am using the codeigniter framework. In the function below i am trying to print the day of year ($doy). When i go to the url and try to access the tip function it shows a blank page. The day of year is not printed.

Code:
public function tip(){      

    $idCount = $this->db->query('SELECT Count(*) AS COUNT FROM clickmag_tip')->result();
    $total = $idCount[0]->COUNT;

    $time = time();
    $doy = mdate('%z', $time);
    echo $doy;
    //$day_of_year = date('z',time());

    //$doyear = date("z") + 1;
    //echo $doyear;

    $s = mktime(date("G") + 1);
    print date("Y/m/d h:i:s a", $s);

    if($total > 0){
        $offset = $doy % $total ;
    }

    $data = $this->db->query('SELECT * FROM table_tip LIMIT 1 OFFSET '. $offset);
    header('Content-type: text/json');
    header('Content-type: application/json');
    echo json_encode($data->result());

}

What do you think is the problem? I talked to the server people but they also don't know. How can i solve this?

Thanks in advance!




Theme © iAndrew 2016 - Forum software by © MyBB