title: Object of class mysqli could not be converted to string js php
body: <p>I saw questions about this problem on overflow, but i can't find the decision.
  This is last variant of my code.
  Sorry but I absolutely 0 in php :(</p>
  
  <pre><code>&lt;?php 
      $host = "*****";
      $user = "*****";
      $pass = "******";
  
      $databaseName = "******";
      $tableName = "product";
  
      $con = mysqli_connect($host,$user,$pass);
      $dbs = mysqli_select_db($con, $databaseName);
      $sql = ( "SELECT * FROM $tableName");
  
      $data = array();
      while ( $row = mysql_fetch_row(mysqli_query("$con", "$sql")) )
      {
        $data[] = $row;
      }
      echo json_encode( $data );
      mysqli_close($con);
     ?&gt;
  </code></pre>
  
  <p>why I receive error</p>
  
  <p>Catchable fatal error: Object of class mysqli could not be converted to string in /home/**/public_html/php/api.php on line 15</p>
  
  <p>on this string</p>
  
  <pre><code>while ( $row = mysql_fetch_row(mysqli_query("$con", "$sql")) )
  </code></pre>