Welcome, Guest. Please login or register.

Author Topic: Brain haz can I? Need help inserting massive ammount of data into a table.  (Read 2230 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline whabangTopic starter

  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 7270
    • Show all replies
Hi,
This isn't related to the Amiga at all, but since many of you are quite competent in these matters, I though this might be a good place to ask:

I'm currently designing a time reporting system for a small company. The idea is to let the drivers report their working hours over the web, instead of snail-mailing their time reports to the main office located in the other end of the country.

Now this should be simple enough; however, they've requested that the web site should look as similar to their own time report cards as possible, and this means that I need to post up to 465 sepearate values from a single web-site at once (15 collumns, and 31 days per month).

Here's the dillema: I need a way to be able to edit all this information through a web-interface. and then save the changes back into the database. It's rather easy to do a row-by-row sollution, saving and loading the userID and date separately, and then the rest of the information together in a single cell using PHP's serialization functions.
The real problems arise when you try to do this to 31 rows at once. How do I attach the date-stamps and the rows to eachother?

There's probably an easy sollution to this, but my brain-cells decided to go on strike, and no ammounts of coffee seems to be able to lure them back to work.

Any suggestions?
Beating the dead horse since 2002.
 

Offline whabangTopic starter

  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 7270
    • Show all replies
Re: Brain haz can I? Need help inserting massive ammount of data into a table.
« Reply #1 on: September 23, 2008, 09:38:13 PM »
Agreed, but since they specifically asked for a system that allows them to edit all days at once, that unfortunately doesn't do me much good.
Beating the dead horse since 2002.
 

Offline whabangTopic starter

  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 7270
    • Show all replies
Re: Brain haz can I? Need help inserting massive ammount of data into a table.
« Reply #2 on: September 23, 2008, 09:49:38 PM »
It's either me, not understanding what you're saying, or the other way around. :-D

Basically, I need to write a page that reads 465 values from a database, displays them all in form fields to allow editing, and then saves everything back when the save button is pressed.

The problem is that I have no clue about how to match the form fields with their corresponding cells once I save it all back to the database.
Beating the dead horse since 2002.
 

Offline whabangTopic starter

  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 7270
    • Show all replies
Re: Brain haz can I? Need help inserting massive ammount of data into a table.
« Reply #3 on: September 23, 2008, 10:50:44 PM »
Quote

cv643d wrote:
Use an array, load it up with 465 values from the DB, echo it out into form fields "
When user hits "submit", catch the action from the queryline and loop through the array and update every value in the DB, ok I admit kinda unoptimized to make 465 queries in a row (but good enough, hopefully :lol: )

But maybe you can set a flag if one field has been updated and only update those fields which has had an update.


That might actually work! Gonna try that tomorrow.
If nothing else, it'll keep the database server busy; almost 900 queries for saving and reloading a single page!  :lol:

I realise that this is an incredibly ineffitient way of doing it, but the customer is always right.  :-D

Thanks for the tips!
Beating the dead horse since 2002.