title: Fatal error: call to a member function fetch_array() on boolean
body: <p>I am getting the error when trying to execute my php script:</p>
  <blockquote>
  <p>Fatal error: call to a member function fetch_array() on boolean in...</p>
  </blockquote>
  <p>The code in question is here:</p>
  <pre><code>function backup()
  {
      global $mysqli;
  
      $bup        = &quot;SELECT p.product_id, p.ean, p.image, p.model,  p.status, p.price_sync, p.modified_by, p.date_modified, pd.name, pd.description, pd.language_id, pd.meta_description, pd.meta_keyword, pd.tag FROM oc_product p INNER JOIN oc_product_description pd ON p.product_id = pd.product_id&quot;;
      $backup     = $mysqli-&gt;query($bup);
      $megainsert = &quot;REPLACE INTO oc_product_backup(product_id, ean, image, model,  status, price_sync, modified_by, date_modified, name, description, language_id, meta_description, meta_keyword, tag) VALUES &quot;;
  
      while($row  = $backup-&gt;fetch_array(MYSQLI_ASSOC))
      {
          $product_id       = $mysqli-&gt;real_escape_string($row['product_id']);
          $ean              = $mysqli-&gt;real_escape_string($row['ean']);
          $image            = $mysqli-&gt;real_escape_string($row['image']);
          $model            = $mysqli-&gt;real_escape_string($row['model']);
          $name             = $mysqli-&gt;real_escape_string($row['name']);
          $description      = $mysqli-&gt;real_escape_string($row['description']);
          $meta_description = $mysqli-&gt;real_escape_string($row['meta_description']);
          $meta_keyword     = $mysqli-&gt;real_escape_string($row['meta_keyword']);
          $tag              = $mysqli-&gt;real_escape_string($row['tag']);
  
          $megainsert      .= &quot;('&quot;.$product_id.&quot;', '&quot;.$ean.&quot;', '&quot;.$image.&quot;', '&quot;.$model.&quot;',  '&quot;.$row['status'].&quot;', '&quot;.$row['price_sync'].&quot;', '&quot;.$row['modified_by'].&quot;', '&quot;.$row['date_modified'].&quot;', '&quot;.$name.&quot;', '&quot;.$description.&quot;', '&quot;.$row['language_id'].&quot;', '&quot;.$meta_description.&quot;', '&quot;.$meta_keyword.&quot;', '&quot;.$tag.&quot;'),&quot;;
      }
  
      $backup-&gt;close();
      $megainsert = substr_replace($megainsert, &quot;&quot;, -1);
      $dobackup   = $mysqli-&gt;query($megainsert);
      if(!$dobackup) return $mysqli-&gt;error;
      else return true;
  }
  </code></pre>
  <p>the following line is where the problem is:</p>
  <pre><code>while($row  = $backup-&gt;fetch_array(MYSQLI_ASSOC))
  </code></pre>
  <p>The code right before the function above is as follows:</p>
  <pre><code>   function clearBackupPrices()
  {
      global $mysqli;
  
      $clean   = &quot;TRUNCATE TABLE oc_product_price_backup&quot;;
      $doclean = $mysqli-&gt;query($clean);
      if(!$doclean) return $mysqli-&gt;error;
      else return true;
  }
  </code></pre>