title: Why Does 'SELECT count()' Return a Value of 'Array'?
body: <p>I am trying to add pagination to my MySQL results page. My goal at the moment is is to divide the number of results in the column (<code>$items_number</code>) by 10 since I want 10 results per page (<code>$per_page = 10</code>). </p>
  
  <p>I had to convert <code>$items</code> into an array since it could not be read as a string, so now I have <code>$items_number = mysqli_fetch_row($items)</code>;</p>
  
  <p>When I echo this in my code to see the number of items in a column, I get a message that says: </p>
  
  <pre><code>Notice: Array to string conversion in /home/ikb2014/public_html/test/classic_cars/pag_test.php on line 46
  </code></pre>
  
  <p>But it also STILL returns a value that says 'Array'. How can I get the value to report the number of items in the column instead of the word 'Array'?</p>
  
  <p>Code:</p>
  
  <pre><code>&lt;?php
  require_once("./includes/database_connection.php");
  
      error_reporting(E_ALL);
      ini_set('display_errors', 1);
  
      $per_page = 10;
      $query = "SELECT productCode, productName, productLine, productScale, productVendor, productDescription, buyPrice FROM products WHERE `productLine` = 'Classic Cars'";
                  $result = mysqli_query($dbc, $query)
                  or die(mysqli_error($dbc));
  
      $query_count = "SELECT count(productLine) FROM products WHERE `productLine` = 'Classic Cars'";
      $items = mysqli_query($dbc, $query_count)
                  or die(mysqli_error($dbc));
      $items_number = mysqli_fetch_row($items);
  
  
  ?&gt;
  
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta charset='utf-8'&gt;
      &lt;title&gt;Home&lt;/title&gt;
      &lt;link type="text/css" rel="stylesheet" href="classic_cars.css" /&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
      &lt;?php
          require_once("./includes/navigation.php");
      ?&gt;
  
  
      &lt;?php
          while ($row = mysqli_fetch_array($result)) { 
              $product_code = $row['productCode'];
              $product_name = $row['productName'];
              $product_line = $row['productLine'];
              $product_vendor = $row['productVendor'];
              $product_description = $row['productDescription'];
              $buy_price = $row['buyPrice'];
  
                  echo "&lt;tr&gt;
                  &lt;td&gt;&lt;p&gt;$product_name&lt;/p&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;p&gt;$items_number&lt;/p&gt;&lt;/td&gt;
                  &lt;/tr&gt;";
  
          } // end while ($row = mysqli_fetch_array($result))
  
      ?&gt;
  
  
      &lt;?php
          require_once("./includes/footer.php");
      ?&gt;      
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>