Hi,

I want to clear or delete old values of array
I attached my database dump with this post
my code is

require_once('includes/DbConnector.php');
require_once('includes/Validator.php');
require_once('includes/CommonUtility.php');
$z=0;
$duplicateFlag=false;
$qury="SELECT orders.order_id,users.company,users.minorderamt,vendororder.vendid   
	   FROM orders 
	   LEFT JOIN vendororder ON  vendororder.orderid=orders.order_id
	   LEFT JOIN users ON  users.user_id=vendororder.vendid  
	   WHERE orders.status='C' AND orders.order_id='368'
	   ORDER BY vendororder.vendid";   
$qryR1=$connector->query($qury); 
while($rsV=$connector->fetchArray($qryR1)){
$total=0; 
$minAmt[]=$rsV['minorderamt'];
$l=0;
 
echo '<TABLE width="100%"  border=0 align=center cellPadding=3 cellSpacing=1 bgColor="#EAEAEA">
	  <TBODY>
	   <TR bgcolor="#FFFFFF">  
		<TD align=left height="55px" colspan=4  class="text13">'.($z+1).' )&nbsp;&nbsp;<B>Vendor:&nbsp;&nbsp;&nbsp;&nbsp;'.$rsV['company'].'</B> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Min Order Amount:<B>&nbsp;$&nbsp;'.sprintf("%1.2f",$rsV['minorderamt']).'</B></TD> 
	  </TR> 
	  <TR bgcolor="#FFFFFF">  
		<TD align=center height="35px"  class="text13"><B>Product</B></TD><TD align=center  height="35px" class="text13"><B>Quantity</B></TD>
		<TD align=center height="35px"  class="text13"><B>Bid Price</B></TD><TD align=center  height="35px" class="text13"><B>Total Amount( $ )</B></TD>
	  </TR>';
         $qry="SELECT bids.bid_id,vendid,orderid,bidamount,status,biddetails.pid,biddetails.qty,biddetails.bidprice,bidprice,product.item_desc,product.product_id
	           FROM biddetails 
			   LEFT JOIN product ON  product.product_id=biddetails.pid
			   LEFT JOIN bids ON  bids.bid_id=biddetails.bid_id 
			   WHERE bids.orderid='".$rsV['order_id']."' AND bids.vendid='".$rsV['vendid']."'  GROUP BY product.product_id 
			   ORDER BY bids.orderid";   
		$qryRslt=$connector->query($qry); echo "<BR> TOTCOUUNT".$numrow=$connector->fnGetNumRows($qryRslt);
		$pp=0;
		while($rs_B=$connector->fetchArray($qryRslt)){
				echo '<TR bgcolor="#FFFFFF">  
						<TD align=center height="35px"  class="text13">'.$rs_B['item_desc'].'</TD><TD align=center  height="35px" class="text13">'.$rs_B['qty'].'</TD>
						<TD align=center height="35px"  class="text13">'.$rs_B['bidprice'].'</TD><TD align=center  height="35px" class="text13">'.(sprintf("%1.2f",$rs_B['bidprice']*$rs_B['qty'])).'</TD>
					  </TR>';

//Here i added all total and vendor id  in array  $indTot[] and  $indVid[] respectively					
			
			  $total=$total+($rs_B['bidprice']*$rs_B['qty']);	 //echo  $rs_B['bidprice']*$rs_B['qty']."<BR>";
			  $indTot[]=($rs_B['bidprice']*$rs_B['qty']);
			  $indVid[]=$rs_B['vendid'];  
			  $indPid[]=$rs_B['product_id'];
			  //array_push($ttarr,$rs_B['bidprice']*$rs_B['qty']);
			 
				  if($z==0)
				  {
					
						   /* $qry="SELECT f_id FROM finaltest WHERE pid='".$rs_B['product_id']."' AND vid='".$rs_B['vendid']."' AND bidid='".$rs_B['bid_id']."' ";   
							$sResult=$connector->query($qry); 
							if($connector->fnGetNumRows($sResult)==0){
								if($rs_M=$connector->fetchArray($sResult)) $f_id=$rs_M['f_id'];  
									$sZql ="INSERT INTO finaltest (pid,vid,bamt,bidid) VALUES ('".$rs_B['product_id']."','".$rs_B['vendid']."','".($rs_B['bidprice']*$rs_B['qty'])."','".$rs_B['bid_id']."')"; 
									$qExec=$connector->query($sZql);
						}  */
				   } 
//Here i am created two combination of that arrays
			
				$pp++; echo $pp."row".$numrow;
				if($pp==$numrow)
				{
					for($i=0;$i<$numrow-1;++$i)
					{ 
					   for($j=$i+1;$j<$numrow;++$j)
					   {
										//  echo $indTot[$p][$i]." + ".$indTot[$p][$j].'<BR>';
									   $vendTwoComb[]=$indTot[$i]+$indTot[$j];
									   $vendTwoCombAmt[]=$indTot[$i]."+".$indTot[$j];  
									   $vendTwoCombVids[]=$indVid[$i]."+".$indVid[$j];  
									   $vendTwoCombPids[]=$indPid[$i]."+".$indPid[$j]; 
									   //echo $indPid[$p][$i]." + ".$indPid[$p][$j].'<BR>';
					   }
					}
					
				  print_r($vendTwoComb); echo count($vendTwoComb);
				echo "----".$jj=count($vendTwoComb);

// I want to delete or clear all values of array here 					
					for($x=0;$x<$jj;$jj--)			
					{
					unset($indTot[$x]); 
					unset($indVid[$x]); 
					unset($indPid[$x]); 
					$x++;
				    }
			    }
						

			 $l++;
		}
		$tamts[]=$total;
		
		echo '<TR bgcolor="#FFFFFF">  
			 <TD align=center height="35px" class="text13"><B>Total Bid Amount</B></TD><TD align=left colspan=3  height="35px" class="text13"> $ <B>'.sprintf("%1.2f",$total).'</B></TD>
		     </TR>';	
$z++;		
}

Please give me suggestion to how to do this??

$array = array();

That will clear an array.

You can also use

unset($array);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.