title: using mysql query for fetch the data from database in php
body: <p>using query more than 4 query for fetch the data base the four query are run properly but i use one more query for fetch the hotel_id and this hotel_id use in different query but when i run the query, the query run properly but didn't get output in while loop and what is my mistake in the code..... this query working properly but $query1 = "select hotel_id from menu_master where menu_id=".$id; but in $hid = $row['hotel_id']; can't store any value in $hid..</p>
  
  <pre><code>$query1 = "select hotel_id from menu_master where menu_id=".$id;
                      $res = mysql_query( $query1);
                      while($row=mysql_fetch_array($res))
                      {
                          $hid = $row['hotel_id'];
                      }
  
                      $query = "select set_rank from menu_master where menu_id = $row_id and hotel_id='".$_REQUEST['hotel_id']."'";
                      //echo $query."&lt;br/&gt;";
                      $result = mysql_query($query);
  
                      while($row=mysql_fetch_array($result))
                      {
                          $current_rank = $row['set_rank'];
                      }
  
                      $current_id = $row_id;
                      $new_rank =$_REQUEST['set_rank'];
  
                       $sql = "select * from menu_master where set_rank = '$new_rank ' and hotel_id='".$_REQUEST['hotel_id']."'" ;    
                       $rs = mysql_query($sql);
  
                      while($row = mysql_fetch_array($rs))
                           {  
                                  $menu_id = $row['menu_id'];
                                  $sql="update menu_master 
                                  set set_rank=$current_rank where menu_id= $menu_id and hotel_id='".$_REQUEST['hotel_id']."'";
  
                                  mysql_query($sql);
  
                           }
  
                                      $sql="update menu_master set 
                                      hotel_id           = '".mysql_real_escape_string($_REQUEST['hotel_id'])."',
                                      menu_name          = '".mysql_real_escape_string($_REQUEST['menu_name'])."',
                                      menu_name_ar       = '".mysql_real_escape_string($_REQUEST['menu_name_ar'])."',
                                      is_active          = '".$is_active."',
                                      set_rank=$new_rank where menu_id= '$current_id' and hotel_id='".$_REQUEST['hotel_id']."'";
                                      mysql_query($sql);
                  }
  </code></pre>