hi all
i am showing results of purchases made by customer.
$qry = "select * from cart table"
$result = mysql_query($qry);
while($row=mysql_fetch_array($result)
{
echo $row['user_name'];
echo $row['product_name'];
echo $row['price'];
echo $row['quantity'];
echo $row['invoice_number'];
echo $row['status'];
}
In the above screeshot
the product “samsung s4 white” is contained in two rows
but one row has invoice number and other row does not have invoice number.
to make it more clear what i am trying to create :
i am querying from the cart table
a customer came and added product to cart so it got added to cart table only.
the customer didnt completed order so there is no value for invoice_number in some rows.
then again after one day he came to website
he added two products and one product has same name that he added before one day.
but this time he completed order and the invoice number got updated in the invoice field.
so there becomes two rows
one with invoice number and other without invoice number but product name remain same in them.
so if he purchased the same product product after one day then both the first entry and second entry of same product name should be removed from cart table.
also the other row which is associated with same invoice number should also be removed.
so thats what i am trying to create.
now can anybody tell me what should be added to my above code ??
if should i write in the if condition to check that similar product has been bought with invoice number so that i can remove those entries from cart table
if(invoice number contained same product)
{
}
vineet