Remove items from my cart in php -


i need here in removing items cart. searched lot of result couldn't understand unset session , how unset it. tried using no result. thing got, have unset session id of product want remove cart. learning php. please can me details , solve this.

my-cart.php

<table class="table table-bordered">              <?php             $ucd=$dbobj->cart();                     while($row=mysql_fetch_array($ucd)) : ?>             <?php             $arr=split(',', $_session["usercart"]); //1&2,3&5             $tot=sizeof($arr); //2             $qty=0;              for($i=0; $i<$tot; $i++)             {                        $ids=split('&', $arr[$i]);  //1 2   | 3 4                 if($row['productid']==$ids[0])                 $qty=$ids[1];                         }             ?>              <tr>                 <td hidden="hidden"><?php echo $row['productid']; ?></td>                 <td><img src="<?php echo $row["product_image"]; ?>" width="200px" height="200px" /></td>                          <td><?php echo $row['product_name']; ?></td>                     <td><?php echo $qty; ?></td>                          <td><?php echo $row['product_price']; ?></td>                 <td><?php $totprice=$row['product_price']*$qty;                          echo $totprice;                 $grandtot+=$totprice;                   ?></td>                   <td><a class="btn btn-danger btn-xs" >remove item</a>                 </td>             </tr>             <?php endwhile; ?>         </table> 

here function created add products in cart.

cart function

public function cart()     {         $arr=split(',', $_session["usercart"]); //1&2,3&5         $tot=sizeof($arr); //2         $s='';         for($i=0;$i<$tot;$i++)         {             $ids=split('&', $arr[$i]);  //1 2   | 3 4             $s=$s.$ids[0].',';  //1,3,         }         $s=$s.'0';         $this->com=mysql_query("select * product productid in($s)", $this->con);     //1,3,0         return $this->com;     } 

thanks


Comments