jayemvee
01-29-2007, 02:46 AM
This is sort of long and it has to do with putting irregular sized Matrix data into mySQL. I have been struggling with it for a long time.. I am desperate.
Here's what the table looks like.
It represents a matrix of values.
tbl_matrix
- UID <! Unique ID
- Sheet_ID <! Sheet the data belongs to
- XIndex <! self explanitory
- YIndex <! self explanitory
- CellValue <! the value that will be in the input shown later
One sheet may have 3 rows of data and 4 columns
And another sheet may have 5 rows of data and 5 columns.
There is a max of 11 columns and 6 rows.
I wrote code to generate a sample form that goes like this...
print "<table border=1>\n";
for( $y = 0; $y <= $num_rows; $y++ ){
print " <tr>\n";
for( $x = $low_xVal - $inc; $x <= $high_xVal; $x += $inc){
if ($x == $low_xVal-$inc){ print " <td>" . $y . "</td>\n";
}else{
if ($y==0){ print " <td>" . $x . "</td>\n";}else{ print " <td><input name=\"matrix" . $x . $y . "\" type=\"text\" size=\"4\" /></td>\n";}
}
}
print " </tr>\n";
}
print "</table>\n\n\n\n";
That will draw out the matrix in the size that you tell it to...
What do I do when it comes time to insert those values into the table without doing it one by one.... Is there a way to loop and insert?
I am so lost on this.
Here's what the table looks like.
It represents a matrix of values.
tbl_matrix
- UID <! Unique ID
- Sheet_ID <! Sheet the data belongs to
- XIndex <! self explanitory
- YIndex <! self explanitory
- CellValue <! the value that will be in the input shown later
One sheet may have 3 rows of data and 4 columns
And another sheet may have 5 rows of data and 5 columns.
There is a max of 11 columns and 6 rows.
I wrote code to generate a sample form that goes like this...
print "<table border=1>\n";
for( $y = 0; $y <= $num_rows; $y++ ){
print " <tr>\n";
for( $x = $low_xVal - $inc; $x <= $high_xVal; $x += $inc){
if ($x == $low_xVal-$inc){ print " <td>" . $y . "</td>\n";
}else{
if ($y==0){ print " <td>" . $x . "</td>\n";}else{ print " <td><input name=\"matrix" . $x . $y . "\" type=\"text\" size=\"4\" /></td>\n";}
}
}
print " </tr>\n";
}
print "</table>\n\n\n\n";
That will draw out the matrix in the size that you tell it to...
What do I do when it comes time to insert those values into the table without doing it one by one.... Is there a way to loop and insert?
I am so lost on this.