title: Grading system using php and mysql
body: <ol>
  <li><p>In the database, some courses value are NULL, and I don't want to print courses that hava a NULL value.
  I don't know how I can achieve this in php or mysql. I need something like so:</p>
  
  <p><code>if(course1!=NULL || course2!=NULL || course3!=NULL || course4!=NULL){
  // echo course1; echo course2; echo course3; echo course4; }</code></p></li>
  </ol>
  
  <p>The database looks like this:</p>
  
  <p><a href="https://i.stack.imgur.com/RMpa4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RMpa4.png" alt="The database"></a></p>
  
  <p>And the output so far look like this:
  <a href="https://i.stack.imgur.com/Kd6GI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Kd6GI.png" alt="enter image description here"></a></p>
  
  <ol start="2">
  <li><p>A remark() function which check whether the course is A, B, C, D, E, or F is not working properly.
  I want the remark() function to output either Excellent, Credit, Pass, or fail base on the grade.</p>
  
  <p>Follows is the code:
      
  
  <pre><code>function remark(){
  
  global $mathematics, $physics, $chemistry, $lang;
  
  if($mathematics=='A' || $physics=='A' || $chemistry=='A' || $lang=='A'){
      $remark = "Excellent";
  }
  
  elseif($mathematics=='B' || $physics=='B' || $chemistry=='B' || $lang=='B' || $mathematics=='C' || $physics=='C' || $chemistry=='C' || $lang=='C'){
  $remark = "Credit";
  }
  elseif($mathematics=='D' || $physics=='D' || $chemistry=='D' ||         $lang=='D' || $mathematics=='E' || $physics=='E' || $chemistry=='E' || $lang=='E'){
      $remark = "Pass";
  }
      else{
      $remark = "Fail";
  }
  return $remark;
  }
  if(isset($_POST['student_id']) &amp;&amp; !empty($_POST['student_id'])){$student_id = $_POST['student_id'];
  
         $check = "SELECT * FROM sample1 WHERE student_id='$student_id'";
         $check_query = mysqli_query($connection, $check);
         if(mysqli_num_rows($check_query)&gt;0){
  
   while($query_row = mysqli_fetch_assoc($check_query)){
  
          $mathematics = $query_row['mathematics'];
          $physics = $query_row['physics'];
          $chemistry = $query_row['chm'];
          $lang = $query_row['lang'];
  
  echo "&lt;table border=1 width=50%&gt;
          &lt;tr&gt; &lt;td&gt;Name: ".$query_row['name']."  &lt;/td&gt; 
              &lt;td&gt;Student Id: ".$query_row['student_id']."&lt;/td&gt;
              &lt;td&gt;Level: ".$query_row['level']."&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt; 
              &lt;th&gt; Course &lt;/th&gt;
              &lt;th&gt; Grade &lt;/th&gt; 
              &lt;th&gt; Remark &lt;/th&gt;  
          &lt;/tr&gt;
  
          &lt;tr&gt; &lt;td&gt;Mathematics &lt;/td&gt; &lt;td&gt;".$mathematics." &lt;/td&gt;&lt;/td&gt; &lt;td&gt;".remark()." &lt;/td&gt;&lt;/tr&gt;
          &lt;tr&gt; &lt;td&gt;Physics &lt;/td&gt; &lt;td&gt;".$physics."&lt;/td&gt; &lt;/td&gt;&lt;td&gt;".remark()." &lt;/td&gt;&lt;/tr&gt;
          &lt;tr&gt; &lt;td&gt;Chemistry &lt;/td&gt; &lt;td&gt;".$chemistry."&lt;/td&gt; &lt;/td&gt;&lt;td&gt;".remark()." &lt;/td&gt;&lt;/tr&gt;
          &lt;tr&gt; &lt;td&gt;Language &lt;/td&gt; &lt;td&gt;".$lang."&lt;/td&gt; &lt;/td&gt;&lt;td&gt;".remark()." &lt;/td&gt;&lt;/tr&gt;
  
      &lt;/table&gt;";
                    }
                  }
                  else{echo "Record not found";}
                  }
  </code></pre></li>
  </ol>