SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 33 of 33

Thread: Am I inscure?

  1. #26
    SitePoint Evangelist
    Join Date
    Jun 2008
    Posts
    455
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Im getting an error/warning that i've never seen before, im getting the following when i use date("Y", mktime()):


    Strict Standards: mktime() [function.mktime]: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/London' for '0.0/no DST' instead in C:\xampp\htdocs\classes\class.base.php on line 87

    Strict Standards: mktime() [function.mktime]: You should be using the time() function instead in C:\xampp\htdocs\classes\class.base.php on line 87

    Strict Standards: date() [function.date]: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/London' for '0.0/no DST' instead in C:\xampp\htdocs\classes\class.base.php on line 87

  2. #27
    Web Professional
    Join Date
    Oct 2008
    Location
    London
    Posts
    862
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by L4DD13 View Post
    Im getting an error/warning that i've never seen before, im getting the following when i use date("Y", mktime()):


    Strict Standards: mktime() [function.mktime]: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/London' for '0.0/no DST' instead in C:\xampp\htdocs\classes\class.base.php on line 87

    Strict Standards: mktime() [function.mktime]: You should be using the time() function instead in C:\xampp\htdocs\classes\class.base.php on line 87

    Strict Standards: date() [function.date]: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/London' for '0.0/no DST' instead in C:\xampp\htdocs\classes\class.base.php on line 87
    Well, it pretty much explains it. You need to set the timezone using one of the methods specified.

    You should also use time() function instead of mktime() if you want the current timestamp. mktime() is only to be used if you want a timestamp for a specified time/date.

  3. #28
    SitePoint Evangelist
    Join Date
    Jun 2008
    Posts
    455
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I dont know why i do that, i get an error and pass the problem onto someone else. I need to start reading them 1st. Thanks for the pointer though.

  4. #29
    Web Professional
    Join Date
    Oct 2008
    Location
    London
    Posts
    862
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by L4DD13 View Post
    I dont know why i do that, i get an error and pass the problem onto someone else. I need to start reading them 1st. Thanks for the pointer though.
    Realising the problem is the first step to solving it

    BTW: They aren't errors as such. They are just standard notices. The code will work if you remove E_STRICT reporting but it's best practice to code with the set rules (some of your code may not work in future versions of PHP if you don't).

  5. #30
    SitePoint Evangelist
    Join Date
    Jun 2008
    Posts
    455
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for pointing out error_reporting(E_ALL | E_STRICT);.

    Its helping me out alot

  6. #31
    SitePoint Evangelist
    Join Date
    Jun 2008
    Posts
    455
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    @SilverBulletUK

    Can you tell me why modification of your class isn't working?

    __DBSETTINGS__ is the script containing the connection variables.

    PHP Code:
    <?php

    class Database
    {

        private static 
    $oInstance null;

        public static function 
    getInstance()
        {
            require_once(
    __DBSETTINGS__);
            if(
    is_null(self::$oInstance)) {
                new 
    DatabaseDBHOSTDBUSERNAMEDBPASSWORDDEFAULT_DATABASE );
            }

            return 
    self::$oInstance;

        }

        private function 
    __construct$sHost$sUsername$sPassword$sDatabase$iPort 3306 )
        {


            try{

                
    $connect = @mysqli_connect$sHost$sUsername$sPassword$sDatabase$iPort);
                if(
    is_resource($connect)){
                    
    self::$oInstance = new mysqli$sHost$sUsername$sPassword$sDatabase$iPort );
                }
                return;
            } catch (
    Exception $oException){
                throw new 
    Exception($oException->getMessage());
                return;
            }

        }

    }

    ?>
    Thanks

  7. #32
    SitePoint Evangelist
    Join Date
    Jun 2008
    Posts
    455
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What is PDO class?

  8. #33
    Web Professional
    Join Date
    Oct 2008
    Location
    London
    Posts
    862
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by L4DD13 View Post
    What is PDO class?
    Google it!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •