title: How to fix Trying to access array offset on value of type null error
body: <p>I am creating a time table view using PHP, in which I am getting the lecture data according to the day and time.</p>
  <p>Here is the code which I have did</p>
  <pre><code>$monday_lectures = &quot;SELECT * from lectures where lecture_time = '11am to 1pm' and lecture_day = 'firday'&quot;;
  $result_11to1 = mysqli_query($con, $monday_lectures);
  $m11to1 = mysqli_fetch_array($result_11to1);
  if ($m11to1[&quot;lecture_day&quot;] == !'') {
      echo &quot;&lt;td&gt;&quot;.$m11to1[&quot;lecture_name&quot;].&quot;&lt;/td&gt;&quot;;
  } else {
      echo &quot;&lt;td&gt; no class&lt;/td&gt;&quot;;
  }
  </code></pre>
  <p>But I am getting below error for the above code:</p>
  <blockquote>
  <p>Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\nexgschool\admin\notify\add_time_table.php on line 45</p>
  </blockquote>