<?php

require ('../conexion.php');

$cdgbodega=$_POST['cdgbodega'];




	   if ($result = $mysqli->query("SELECT cdgbod,dscbod FROM bodegas WHERE cdgbod = '$cdgbodega'  "  )) {
  $nrs = $result->num_rows;
   
   $result->close();
}


if( $nrs>0){
	$html='';
//	$html.= '<option  value="">TODAS</option>';
$consulta="SELECT cdgbod,dscbod FROM bodegas WHERE cdgbod <> '$cdgbodega' ORDER BY cdgbod ASC";
								
			$query = mysqli_query($mysqli, $consulta)or die('error: '.mysqli_error($mysqli));
			
			
			while ($data = mysqli_fetch_assoc($query)) { 
			$html.= '<option  value="'.$data['cdgbod'].'">'.$data['dscbod'].'</option>';
			}
			
			echo $html;	
	
}

else {
	   echo "0";
	}
?>

