View Full Version : spreadsheet

10-23-2004, 03:00 PM
Has anyone come across a PHP spreadsheet? I've been searching for a while but haven't been able to find one.

Basically I have a fixed number of columns 31, and I need a variable number of rows. The data has to be either written to a file, maybe xml or comma delimited text file or a mysql database.

I could write it myself but if there is an existing system out there I'd like to base my code on that if possible, save me the time and effort.

10-23-2004, 03:46 PM
i've done things like that.

there a a few tricks to do this efficiently:
- the formfielddata (your rows and columns of the datasheet) should be one multidimensional array like

<input type="text" name="datasheet[xxx][yyy]" ... />

where xxx is the Primary Key of the record, and yyy is the columnname.
Note --> no quotes around the arreykeys !

- you also need to store the same array in a sessionvariable
- after posting, you compaire each element from

$_POST['datasheet'] to the corresponding record from $_SESSION['datasheet']
This way you only need to update the records where one of the values was actually changed

- if the page is accesible to people that don't need to know your tablestructure, then you need to keep an extra session-array with the columnnames and their order in the table + use that order as yyy

10-23-2004, 05:16 PM
Good ideas.
I was thinking about just numbering each sequentially and then splitting them into rows and cols on the serverside.. But that way is more efficient by far.

Seeing as you have some experience I probably be back if I get stuck. But I think I can handle it. Thanks. :thumbsup: