title: Fatal Error: unidentified method mysqli:fetch_array()
body: <p>I am writing a time clock program and I am running into an error that I can not seem to find in the code. After looking over the code, I do not find an error where it says there is one. I did a check on PHP Code Checker too and it did not find one. Here is the code that I am using. I have modified the sensitive information. What am I doing wrong and how can I fix it. I was following the example on the 3rd answer here:
  <a href="https://stackoverflow.com/questions/15251095/display-data-from-sql-database-into-php-html-table">display data from SQL database into php/ html table</a></p>
  <p>Here is the output:</p>
  <blockquote>
  <p>Fatal error: Call to undefined method mysqli::fetch_array() in path to file on line 31</p>
  <p>Punch ID  Time    Punch Type  Group   Department  Notes
  and the code</p>
  </blockquote>
  <pre><code>&lt;head&gt;
      &lt;title&gt;View My Punches&lt;/title&gt;
      &lt;body bgcolor=&quot;#9966FF&quot;&gt;
      &lt;link rel=&quot;icon&quot; type=&quot;image/ico&quot; href=&quot;path to favicon&quot;/&gt;
  &lt;/head&gt;
  
  &lt;?php
  error_reporting(E_ALL); ini_set('display_errors', 1);
  define('DB_NAME', 'name');
  define('DB_USER', 'user');
  define('DB_PASSWORD', 'password');
  define('DB_HOST', 'host');
  
  
  $link = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
  
  if ($link-&gt;connect_errno &gt; 0){
      die('Could not connect: ' .connect_error());
  }
  $userid_value = $_POST['userid'];
  $table = &quot;tc_&quot;.$userid_value;
  $checkusersql = &quot;SELECT * FROM tc_users WHERE userid = '$userid_value'&quot;;
  $usercheck = $link-&gt;query($checkusersql);
  $punchessql = &quot;SELECT * FROM $table&quot;;
  $result = $link-&gt;query($punchessql);
  if ($usercheck-&gt;num_rows == 0) {
      echo &quot;Sorry, &quot; . $userid_value . &quot; is not a valid user ID. Please try again.&quot;;
  }else {
      echo &quot;&lt;table&gt;&quot;;
      echo &quot;&lt;tr&gt;&lt;td&gt;Punch ID&lt;/td&gt;&lt;td&gt;Time&lt;/td&gt;&lt;td&gt;Punch Type&lt;/td&gt;&lt;td&gt;Group&lt;/td&gt;&lt;td&gt;Department&lt;/td&gt;&lt;td&gt;Notes&lt;/td&gt;&lt;/tr&gt;&quot;;
      while ($row = $link-&gt;fetch_array($result))
      {
          echo &quot;&lt;tr&gt;&lt;td&gt;&quot; . $row['id'] . &quot;&lt;/td&gt;&lt;td&gt;&quot; . $row['time'] . &quot;&lt;/td&gt;&lt;/tr&gt;&quot; . $row['punchtype'] . &quot;&lt;/td&gt;&lt;td&gt;&quot; . $row['groupname'] . &quot;&lt;/td&gt;&lt;td&gt;&quot; . $row['dept'] . &quot;&lt;/td&gt;&lt;td&gt;&quot; . $row['notes'] . &quot;&lt;/td&gt;&lt;td&gt;&quot;;
      }
      echo &quot;&lt;/table&gt;&quot;;
  }
  
  ?&gt;
  </code></pre>