| | |
delete or clear array??
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Apr 2008
Posts: 296
Reputation:
Solved Threads: 11
Hi,
I want to clear or delete old values of array
I attached my database dump with this post
my code is
Please give me suggestion to how to do this??
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).' ) <B>Vendor: '.$rsV['company'].'</B> Min Order Amount:<B> $ '.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??
Last edited by Aamit; May 31st, 2009 at 6:13 pm.
www.fijiwebdesign.com - web design and development and fun
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
![]() |
Similar Threads
- How to delete item from array of instances (C#)
- Delete From String array (VB.NET)
- How to use a for loop to clear a 2d array (C++)
- Delete an item from an array (C)
- How do I delete an instance of an Array? (C++)
Other Threads in the PHP Forum
- Previous Thread: How to insert checkbox data into mysql?
- Next Thread: display data from a excel file
Views: 1856 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access address ajax apache api array autoincrement beginner binary broken cakephp checkbox class cms code cron curl database date dehasher directory display download dynamic echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla jquery limit link login loop mail menu method methods mlm mod_rewrite multiple mysql oop parse paypal pdf php problem query radio random recursion regex remote script search select server sessions sms soap source space speed sql structure support! syntax system table tutorial update updates upload url validation validator variable video web xml youtube






