Hello i am trying to connect my mobile service with my database...

this is the script

public $username = "root";
    public $password = "";
    public $server = "localhost";
    public $databasename = "rove";
     public $port = "80";
    public $connection;
    public function __construct ()
    {
        $this->connection = mysqli_connect($this->server, $this->username, 
        $this->password, $this->databasename);
        $this->throwExceptionOnError($this->connection);
    }

and i am getting this error

Fatal error: Call to undefined method User::throwExceptionOnError() in C:\Program Files (x86)\Zend\Apache2\htdocs\PHPRovespier\services\User.php on line 19

Can anyone explain to me what is this and how to fix it?

Recommended Answers

All 3 Replies

i am also getting this but i dont know how to fix it

Warning: User::__construct(): It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting 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 the timezone 'UTC' for now, but please set date.timezone to select your timezone. in C:\Program Files (x86)\Zend\Apache2\htdocs\PHPRovespier\services\User.php on line 20

The first error happens because the throwExceptionOnError() method is missing from your class. Regarding the second warning, as explained by the message: define the default timezone in your php.ini file or use:

date_default_timezone_set('UTC');

More information here:

By the way, the following class seems to match your constructor code, as you see, at the end of the file, there is also the missing method:

If you still don't solve then share your full class.

Thanks again Cereal... I got it...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.