0

I have created a class in PHP to handle most of the work dealing with the MySQL database. Here is a code example:

class DataAccessBase
{
protected $sql_wr;
protected $sql_ro;

function __construct()
{
    $this->sql_wr = new mysqli();
    $this->sql_ro = new mysqli();

    $this->sql_wr->ssl_set(DB_WR_SSLKEY, DB_WR_SSLCERT, DB_WR_SSLCA, NULL, NULL);
    $this->sql_ro->ssl_set(DB_RO_SSLKEY, DB_RO_SSLCERT, DB_RO_SSLCA, NULL, NULL);
}

When the constructor runs, I get "Commands out of sync..." error on the new mysqli();. Both of them.
All of the searching I have done discusses incorrect code trying to do multiple queries. I get the error before I even open the connection.
What am I missing?
I have tried using the mysqli_init() also and it returns the same error.

Bill Soranno
  • 63
  • 1
  • 1
  • 6

1 Answers1

0

I change my code to add the parameters to the mysqli() call.

$this->sql_wr = new mysqli(DB_WR_HOST, DB_WR_USER, DB_WR_PASS, DBNAME);  

I no longer get the error on the new.
I now have other errors, but I will open a new question if needed.

Bill Soranno
  • 63
  • 1
  • 1
  • 6