471,084 Members | 797 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,084 software developers and data experts.

if same product in multiple rows and contain invoice number

hi all

i am filtering results of purchases made by customer.

Expand|Select|Wrap|Line Numbers
  1. $qry = "select * from mytable"
  2. $result = mysql_query($qry);
  3. while($row=mysql_fetch_array($result)
  4. {
  5.     echo $row['user_name'];
  6.     echo $row['product_name'];
  7.     echo $row['price'];
  8.     echo $row['quantity'];
  9.     echo $row['invoice_number'];
  10.     echo $row['status'];
  12. }

See the screenshot for results displayed.

the product "samsung s4 white" is contained in two rows

but one row has invoice number and other row does not have invoice number.

So what i want is

if same product name is contained in two rows and one of them has invoice number
then these both rows should not get display and also the row containing same invoice number should not display.

means all 3 rows should be omitted.

so how to check that same product product is in another row but that row also contains invoice number.

so what should i write in the "if condition"

Expand|Select|Wrap|Line Numbers
  1. if(invoice number contained same product) 
  2. {
  4. }
Attached Images
File Type: jpg ct.jpg (25.8 KB, 107 views)
Aug 13 '16 #1
0 933

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Neil Zanella | last post: by
5 posts views Thread by Antanas | last post: by
3 posts views Thread by =?Utf-8?B?S2F5xLFoYW4=?= | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.