Jump to content

manupulating Multidimentional arrays


ceci

Recommended Posts

Hi all.

 

I have a mysql table with two main columns ColumnX and ColumnY each containing data in '|' delimited format.

Eg. Column X = |A|B|C|D|E| and Column Y = |a|b|c|d|e|

 

Using this data column X and Column Y I need to Dynamically construct a table like the one below. The end-user will be able to

enter a value for each corresponding X,Y value. eg. good bad. See attached file for screenshot.

 

<table  border="2">
<tr>
<td> </td>
<td>A</td> 
<td>B</td> 
<td>C</td>
<td>D</td>
<td>E</td>
<td>F</td>
<td>G</td>
</tr>
<tr>
<td>a</td> 
<td>good</td> 
<td>good</td> 
<td>good</td>
<td>bad</td>
<td>good</td>
<td>good</td>
<td>good</td> 
</tr>
<tr>
<td>b</td> 
<td> </td> 
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td> 
<td> </td>
</tr>
<tr>
<td>c</td> 
<td> </td> 
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td> 
<td> </td>
</tr>
<tr>
<td>d</td> 
<td> </td> 
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td> 
<td> </td>
</tr>
<td>e</td> 
<td> </td> 
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td> 
<td> </td>
</tr>
<td>f</td> 
<td> </td> 
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td> 
<td> </td>
</tr>
<td>g</td> 
<td> </td> 
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td> 
<td> </td>
</tr>
</table> 

Take a look at this image to give you a better idea of what I need to accomplish.

http://audiologyonline.com/resources/article/hatchertable.png

 

What would be the best way to accomplish this?

 

Thank you so much.

 

Ceci

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/193938-manupulating-multidimentional-arrays/
Share on other sites

take a look at this http://www.phpfreaks.com/forums/index.php/topic,289377.0.html

 

Your table has one more dimension, but I think starting principle is similar. You'll have to output something like:

<input type="text" name="thing[3][5]">

 

You might need either for or foreach loop, I am not right away sure which.

 

Goat

Thanks for the link its somewhat helpful.

 

To make things simpler, say I have two variables.

 

$var1 = |A|B|C|;

$var2 = |X|Y|Z|;

 

how do i generate dynamically table with a top header with A B C and a LEFT COLUMN with X Y Z?

I am hoping that once this is figured out, things will start to make sense at least on my end.

 

Right now I am just stumped  as to how to achieve this... I hope someone has an example I can take a look at.

 

Thanks again.

 

C

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.