Jump to content

columns to an array


fj1200

Recommended Posts

I'm not a programmer and learning php.  I'm modifying a simple php web app that I wrote last year that queries a MSSQL db, but on one  particular page I need to present the data in a DB collumn as a row.  I want to display a production board electronically as the current whiteboard gets defaced.  All the data is held in a db - easy enough.  The scenario is this:  Production occurs on on, say machine A that is comprised of a number of units.  Sometimes all 10 units will be used, other times, for example, only units 1,2,5 7 may be used.  In the database, the info is held in a table and referenced as a combination of machine and unit, so m/c A Unit 2 is A02 and so on.  I'm not worried about that - eay enough to split out.  I have a set of columns on the page - one for each unit - that I want to have an 'X' or change the bg_colour in the table cell if that unit is to be used and to be blank if not. So:

 

M/C  JOB      ORDER  1  2  3  4  5  6  7  8  9  10

A    10123  12,500  X  X  X    X  X

A    10124  25,750  X  X  X

B    12584  90,800  X  X  X  X  X  X  X  X  X  X

 

All other data displays fine, I just need some help with this bit.  I'm sure an array is the way to do it and have a $UNIT[n] value.  The DB table is structured:

 

JOB_ID  MACHINE  UNIT

10123    A01

10123    A02

10123    A03

10123    A05

10123    A06

10124    A01

10124    A02

10124    A03

etc...

 

Hope this is understandable!

Link to comment
https://forums.phpfreaks.com/topic/92256-columns-to-an-array/
Share on other sites

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.