title: Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error' .. C:\xampp\..PDOStatement->fetch().. on line 83
body: <p>I have actually seen similar questions on this &quot;<strong>Fatal error: Uncaught exception 'PDOException'&quot;</strong>.</p>
  <p>But I have not been able to use have I have seen to resolve the challenge am having.</p>
  <p>Below are the code and the error message</p>
  <pre><code>&lt;?php 
  $sql5 = &quot; set @rownum := 0; 
  set @sum := 0;
  
  select DISTINCT(ROUND(the_avg,4))
   FROM (
      select water_level, 
  @rownum := (@rownum + 1) as rownum, 
  @sum := IF(@rownum mod 7 = 1,0 + water_level,@sum + water_level) as running_sum,
  IF(@rownum mod 7 = 0,@sum / 7,NULL) as the_avg
  FROM &quot; .$table.&quot; WHERE record_month_year = '&quot;.$startDateReport.&quot;'
  order by id ASC
  ) s &quot;;
  $result5 = $db-&gt;prepare($sql5);
  $result5-&gt;execute();
  while ($rowReport = $result5-&gt;fetch(PDO::FETCH_ASSOC)) {
      ?&gt;
      &lt;tr style=&quot;font-size:11px;&quot;&gt;
          &lt;td&gt;&lt;?php echo $rowReport['the_avg'] ; ?&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;?php 
          }
          ?&gt;
  </code></pre>
  <p><strong>The line 83 is :</strong></p>
  <pre><code>while ($rowReport = $result5-&gt;fetch(PDO::FETCH_ASSOC)) {
  </code></pre>
  <p><strong>error:</strong></p>
  <blockquote>
  <p>Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error' in C:\xampp\htdocs\awos\includes\loadboreholedatareport.php:83 Stack trace: #0 C:\xampp\htdocs\awos\includes\loadboreholedatareport.php(83): PDOStatement-&gt;fetch() #1 C:\xampp\htdocs\awos\borData-report.php(46): include('C:\xampp\htdocs...') #2 {main} thrown in C:\xampp\htdocs\awos\includes\loadboreholedatareport.php on line 83.</p>
  </blockquote>