N
N
narem2018-12-09 16:35:56
PHP
narem, 2018-12-09 16:35:56

How to connect to OOP DB?

I'm trying to do so

class connect{
    public $db = mysqli_connect('localhost', 'root', 'amV5TbDYH8', 'News');
    public function dbconnect($db){
      if($db){
        echo "ok";
      } die (mysql_error());
    }
  }

but because of the line
public $db = mysqli_connect('localhost', 'root', 'amV5TbDYH8', 'News');

The site crashes and writes
Page not available
Site ***** cannot process this request yet.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question