title: How can if statement be used within echo
body: <p>I have to  check the results  that are coming from fetch array, I am using <code>else if</code> or <code>if</code> to get the remarks. But I do not know how to use it with in echo, When I run this code all the remarks statements come in same form as written in code.</p>
  
  <p>In this I have to  check the results  that is coming from fetch array, so for this I am using else if or if to get the remarks..but i am do not know how to use it with in echo. When I run this code all the remarks statements come in same form as written in code</p>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>     &lt;?php
      $answer = '';
        include('config.php');
        if(isset($_GET["results"]))
       $answer = $_GET["results"];
        $id = $_GET["idk"];
        switch ($answer) 
        {  
          case 'Nursery':
          $qqqs = mysql_query("select * from result where u_id='$id' AND sc='Nursery' ");
          $rows=mysql_fetch_assoc($qqqs);
          $a=$rows['u_id'];
          $b=$rows['name'];
          $c=$rows['fname'];
          $d=$rows['reg'];
          $e=$rows['sc'];
          $f=$rows['ss'];
          $g=$rows['se'];
          $h=$rows['e1'];
          $i=$rows['u1'];
          $j=$rows['m1'];
          $k=$rows['s1'];
          $l=$rows['ss1'];
          $m=$rows['i1'];
          $n=$rows['e2'];
          $o=$rows['u2'];
          $p=$rows['e3'];
          $pp=$rows['u3'];
          $pic=$rows['picture'];
          $total=$h+$i+$j+$k+$l+$m+$n+$o+$p;
          $totals=230;
  
          $res = ( $totals / $total) * 100;
  
          // 0 digit after the decimal point
          $res = round($res); // 67
  
          // 1 digit after the decimal point
          $res = round($res, 1); // 66.7
  
          // 2 digits after the decimal point
          $res = round($res, 2); // 66.67
  
  
          echo "&lt;html&gt;
          &lt;head&gt;
  
          &lt;/head&gt;
          &lt;body&gt;
          &lt;table align='center' border='4' bgcolor='white' width='500' class='table table-bordered'&gt;
          &lt;tr&gt;
          &lt;td bgcolor='orange' colspan='4'&gt;&lt;h2 align='center'&gt;Leads Grammar School&lt;/h2&gt;&lt;p align='center'&gt;Babar Road, Kirri Jamandan, Multan&lt;/p&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
          &lt;td bgcolor='yellow' colspan='4'&gt;&lt;h2 align='center'&gt;Monthly Test Feb-March&lt;/h2&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
           &lt;td colspan='2'&gt;&lt;img src='images/$pic' width='100px' height='100px' align='right'&gt;&lt;/td&gt;
           &lt;/tr&gt;
          &lt;tr&gt;
          &lt;td align='right'&gt;Student's Name&lt;/td&gt;
  
          &lt;td colspan='3'&gt;$b&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
          &lt;td align='right'&gt;Father's Name&lt;/td&gt;
          &lt;td colspan='3'&gt; $c&lt;/td&gt;
  
          &lt;/tr&gt;
          &lt;tr&gt;
          &lt;td align='right'&gt;Registration&lt;/td&gt;
          &lt;td colspan='3'&gt;$d&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
          &lt;td align='right'&gt;Student Class&lt;/td&gt;
          &lt;td colspan='3'&gt;$e&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
          &lt;td align='right'&gt;Exams&lt;/td&gt;
          &lt;td colspan='3'&gt;$f&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr bgcolor='gray'&gt;
          &lt;th&gt;Subject Name&lt;/th&gt;
          &lt;th&gt;Marks&lt;/th&gt;
          &lt;th&gt;Obtained Marks&lt;/th&gt;
          &lt;th&gt;Grades&lt;/th&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
          &lt;tr&gt;&lt;td&gt;English(Writing)&lt;/td&gt;
          &lt;td&gt;50&lt;/td&gt;
          &lt;td&gt; $h&lt;/td&gt;
  
          &lt;/tr&gt;
          &lt;tr&gt;
          &lt;tr &gt;&lt;td&gt;Urdu(Writing)&lt;/td&gt;
          &lt;td&gt;50&lt;/td&gt;
          &lt;td&gt;$i&lt;/td&gt;
  
          &lt;/tr&gt;
          &lt;tr&gt;
          &lt;tr &gt;&lt;td&gt;Math(Writing)&lt;/td&gt;
          &lt;td&gt;50&lt;/td&gt;
          &lt;td&gt; $j&lt;/td&gt;
  
          &lt;/tr&gt;
          &lt;tr&gt;&lt;th align='center' colspan='3' bgcolor='orange'&gt;General Knowledge&lt;/th&gt;&lt;/tr&gt;
          &lt;tr&gt;
          &lt;tr &gt;&lt;td&gt;Science&lt;/td&gt;
          &lt;td&gt;10&lt;/td&gt;
  
          &lt;td&gt; $k&lt;/td&gt;
  
          &lt;/tr&gt;
          &lt;tr&gt;
          &lt;tr &gt;&lt;td&gt;S.Studies&lt;/td&gt;
          &lt;td&gt;10&lt;/td&gt;
          &lt;td&gt;$l&lt;/td&gt;
          &lt;/tr&gt;
  
          &lt;tr&gt;
          &lt;tr &gt;&lt;td&gt;Islamiat&lt;/td&gt;
          &lt;td&gt;10&lt;/td&gt;
          &lt;td&gt;$m&lt;/td&gt;
          &lt;/tr&gt;
  
          &lt;tr&gt;&lt;th align='center' colspan='3' bgcolor='orange'&gt;Poems&lt;/th&gt;&lt;/tr&gt;
          &lt;tr&gt;
          &lt;tr &gt;&lt;td&gt;English &lt;/td&gt;
          &lt;td&gt;15&lt;/td&gt;
          &lt;td&gt; $n&lt;/td&gt;
          &lt;/tr&gt;
  
          &lt;tr&gt;
          &lt;tr &gt;&lt;td&gt;Urdu&lt;/td&gt;
          &lt;td&gt;15&lt;/td&gt;
          &lt;td&gt;$o&lt;/td&gt;
          &lt;/tr&gt;
  
          &lt;tr&gt;&lt;th align='center' colspan='3' bgcolor='orange'&gt;Book Reading&lt;/th&gt;&lt;/tr&gt;
          &lt;tr&gt;
          &lt;tr&gt;&lt;td&gt;English &lt;/td&gt;
          &lt;td&gt;10&lt;/td&gt;
          &lt;td&gt;$p&lt;/td&gt;
          &lt;/tr&gt;
  
          &lt;tr&gt;
          &lt;tr &gt;
          &lt;td&gt;Urdu&lt;/td&gt;
          &lt;td&gt;10&lt;/td&gt;
          &lt;td&gt;$pp&lt;/td&gt;
          &lt;/tr&gt;
           &lt;tr&gt;
           &lt;td&gt;&lt;h1&gt;Total Marks&lt;/h1&gt;&lt;/td&gt;
           &lt;td&gt;230&lt;/td&gt;
           &lt;td&gt;$total&lt;/td&gt;
           &lt;td&gt;$res&lt;/td&gt;
           &lt;/tr&gt;
           &lt;tr&gt;&lt;td&gt;&lt;h2&gt;Remarks&lt;/h2&gt;&lt;/td&gt;
           &lt;td colspan='3'&gt;
           if(91=&lt;$res&lt;=100)
           {
              echo 'Exceptional';
           } 
          else  if(81=&lt;$res&lt;=90)
           {
              echo 'Excellent';
           } 
            else  if(71=&lt;$res&lt;=80)
           {
              echo 'Very Good';
           } 
            else  if(61=&lt;$res&lt;=70)
           {
              echo 'Good';
           } 
            else  if(51=&lt;$res&lt;=60)
           {
              echo 'Fair';
           } 
            else  if(40=&lt;$res&lt;=50)
           {
              echo 'Pass';
           } 
            else  if(01=&lt;$res&lt;=39)
           {
              echo ' Needs Improvement';
           } 
       else  if($res==0)
           {
              echo ' Needs Improvement';
           } 
      &lt;/td&gt;
      &lt;/tr&gt;
          ";
  
          break;
  }
  ?&gt;
  </code></pre>