<?php include('../../includes/checkSession.php'); ?>
<option value="">Select</option>
<?php
include('../../includes/con2pma3.php');
$id = $_SESSION['id'];
$expand_id = $DID=$_GET["q"];
$GID=$_GET["p"];
			   
      $resultS = mysql_query("SELECT * FROM scope_dwg  where dwgID ='$expand_id'");
      $rowS = mysql_fetch_array($resultS, MYSQL_ASSOC);
  

   // for ($i = $row['range_from']; $i <= $row['range_to']; $i++) {

    $query = "SELECT id, sheet_no, rev_no, dwg_title, dwg_title2, range_no FROM scope_dwg_revisions WHERE dwg_id =$DID";
    $result = mysql_query($query);
    $have_rows = mysql_num_rows($result);
    //$rew = mysql_fetch_object($result);

    if ($have_rows) {
		while($rew = mysql_fetch_object($result)){	
    ?>
		<option value="<?php echo $rew->id?>"  <?php echo (($GID == $rew->id) ? "selected='selected'" : "");?>><?php echo $rowS['dwg_suffix'] ." - ". $rew->range_no; ?> - <?php echo str_pad($rew->sheet_no, 3, '0', STR_PAD_LEFT) . " - " . str_pad($rew->rev_no, 3, '0', STR_PAD_LEFT); ?> - <?php echo $rew->dwg_title ?> - <?php echo $rew->dwg_title2 ?></option>
		<?php
		
		}
	}
//} ?>