Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

MYSQL Problems


Guest

Recommended Posts

Posted

Hello, I know there's a lot of MYSQL expert here and hope somebody can help me to solve this problem which I've dealed with over a week!

 

I would like to generate a sales report with the below information

 

Invoice No. | Date | Name | Subtotal | Shipping | Total |

 

I've tried my best to wrote the following statment

 

$select = "SELECT oi.inv, oi.date_added, o.customers_name, o.payment_method, ot.value from orders_invoices oi LEFT JOIN orders o ON (oi.orders_id = o.orders_id) LEFT JOIN orders_total ot ON (ot.orders_id = oi.orders_id AND ot.class = 'ot_subtotal')";

 

But either Subtotal, shipping or total can be quote instead of all of them. Can anyone tell me what I can do? Is there any method to quote them all in one file? Thank You :blush:

Posted

Let me start with... I'm not a mySQL expert but I play one on TV.

 

I don't have a table called orders_invoices in my database. Maybe it's from a contribution you added.

Anyway, if I needed to create a report that displays multiple rows of information displayed as one row, I would use PHP.

 

You can use PHP to run the query and store the values in an array.

One you have the data in an array you could print the info however you want.

 

HTH,

Robert

Posted

Hello, Thank you very much. I am really an idoit in programming in fact. Yes, the invoice table is added by myself in order to add an invoice number to those approved orders.

 

Do you mind tell me more about how to add an array? The above statement is using php (I think, becuase this is inside a file export.php)

 

I know my main problem is I am still very confused about the most important "Array" stuff in php. Thus my concept is really bad.............. Hope you can help...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...