title: run php statement in switch case
body: <p>is this possible?? if yes than whats wrong with the code cause its not working
  else suggest another efficient method cause if i use (if else) statements it will become mess of about 24 to 26 if else conditions.... and 4 more case statements there</p>
  
  <p><strong>rewritten code</strong></p>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>    &lt;?php
          $c = mysql_connect("localhost", "abc", "xyz");
          mysql_select_db("root");
          $bodytype = $_GET["name"]; //from another page through ajax
          $company  = $_GET["name2"]; //from another page through ajax    
          $Array    = array($bodytype,$company );
          $q="select * from product";
                  $qc=mysql_query($q);
                  $ans=mysql_fetch_array($qc);
                  $ans[6];
                  $ans[1];
      switch ($Array)
      {
          case array($ans[6],$ans[1]):
                          $q="select * from product where bodytype='$bodytype'&amp;&amp; Companyname='$company' GROUP BY modelname";
                          $qc=mysql_query($q);
                          $ans=mysql_fetch_array($qc);
                          $count=0;
                          while($ans=mysql_fetch_array($qc))
                          {
                                  if ($count == 0 || $count == 1 || $count == 2)
                                  {
  
                                  $title=ucwords($ans[1]." ".$ans[2]);
  
                                  print "&lt;div class='img-wrap'&gt;
                                          &lt;img id='display_img' src='products/$ans[8]' width=300 height=200 title='$title'&gt;
                                          &lt;div class='img-overlay'&gt;
                                          &lt;input type='checkbox' id='compare_pro' /&gt; Add to compare
                                          &lt;h4&gt;".$title."&lt;/h4&gt;
                                          &lt;p&gt;".nl2br($ans[9])."&lt;/p&gt;
                                          &lt;p&gt;"."&lt;b&gt;Versions:&lt;/b&gt; ".$ans[3]."&lt;/p&gt;
                                          &lt;p&gt;"."&lt;b&gt;Starting Price:&lt;/b&gt;"." &amp;#x20B9 ".$ans[4]."&lt;/p&gt;
                                          &lt;/div&gt;
                                          &lt;/div&gt;";
                                  }
                                  $count++;
                                  if($count==3)
                                  {
                                      print "&lt;br /&gt;";
                                      $count = 0;
                                  }
                          }
        break;
      case array($ans[6],'not'):
                          $q="select * from product where bodytype='$bodytype' GROUP BY modelname";
                          $qc=mysql_query($q);
                          $count=0;
                          while($ans=mysql_fetch_array($qc))
                          {
                                  if ($count == 0 || $count == 1 || $count == 2)
                                  {
  
                                  $title=ucwords($ans[1]." ".$ans[2]);
  
                                  print "&lt;div class='img-wrap'&gt;
                                          &lt;img id='display_img' src='products/$ans[8]' width=300 height=200 title='$title'&gt;
                                          &lt;div class='img-overlay'&gt;
                                          &lt;input type='checkbox' id='compare_pro' /&gt; Add to compare
                                          &lt;h4&gt;".$title."&lt;/h4&gt;
                                          &lt;p&gt;".nl2br($ans[9])."&lt;/p&gt;
                                          &lt;p&gt;"."&lt;b&gt;Versions:&lt;/b&gt; ".$ans[3]."&lt;/p&gt;
                                          &lt;p&gt;"."&lt;b&gt;Starting Price:&lt;/b&gt;"." &amp;#x20B9 ".$ans[4]."&lt;/p&gt;
                                          &lt;/div&gt;
                                          &lt;/div&gt;";
                                  }
                                  $count++;
                                  if($count==3)
                                  {
                                      print "&lt;br /&gt;";
                                      $count = 0;
                                  }
                          }   
        break;
  ?&gt;
  </code></pre>
  
  <p>Is it possible to have multiple control variables in a switch statement?</p>
  
  <p><strong>example :</strong></p>
  
  <pre><code>a=1;
      b=2;
  
          switch(a , b)
              {
                     case(1,2): print "true";
                     break;
                     case(2,1): print "false";
                     break;               
              } 
  </code></pre>