Hi,

need to generate a report like Table Format(Excel Sheet)
 this is an example view of the report which I need of 

   it is for maintaining branch wise details

   In that product name contin in one table 

   and stock of each branch will contain in another table 


   --------------------------------------------------------------------
   |        |    Moniter    |    mouse    |    keyboard    |    CPU   |
   --------------------------------------------------------------------
   |Branch1 |        3      |      2      |      2         |     1    |
   --------------------------------------------------------------------
   |Branch2 |        2      |      3      |      1         |     3    |
   --------------------------------------------------------------------
   |  ...   |               |             |                |          |
   --------------------------------------------------------------------
   |Branchn |        2      |      3      |      1         |     3    |
   --------------------------------------------------------------------

   I want to generate report like this 

   In the  above report it deals with 3 tables in mysql 
   1. Product Table  (to maintain product details)
   2. Branch Table   (to maintain branch details)
   3. stock qunatity table (to  stock details with branch Id as well as product Id details)
Member Avatar for diafol

There are a few approaches to this you could take, but I'd try to keep it as simple as possible by getting all my data into one array with a multiple join statement and then mess about with php. Trying to create this type of crosstab in MySQL can be tricky.

I'm busy at the mo, but if nobody comes back to you by tonight, I'll have a go at giving an example. BTW - I recently did something similar - if you search 'diafol crosstab' you may find it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.