Re: checkboxes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Excellent response. You should always be expecting certain data. So if no checkboxes are checked, your code should realize that since it was expecting the data and none was submitted. The "lazy way" is much easier to code, but it is actually fairly efficient. You are only hitting the database twice, once of the delete and once for the bulk insert. On a fixed record length table, the lazy way may actually be quicker.

On Nov 30, 2005, at 2:23 AM, Curt Zirzow wrote:

So we have a form that will eventually need to knnow  what values
should be selected. Potentially data alreadly exists that may have
the same records. There are two options (or perhaps more) to
approach this:

Decide as we go approach and clean up:

  1) Grap the 'vehicles' currently assoicated with the 'lot'
  2) if 'vehicle' is currently selected do nothing
  3) if 'vehicle' is a new item we should add 'vehicle' as long as it
     is a valid 'vehicle;
  4) repeat 2 and 3 until we looked at all the data
  5) figure out which ones should be deleted and delete them.


Forget everything, we'll add what is valid (the lazy way):

  1) delete every associated record to the 'lot'
  2) for each 'vehicle' add 'vehicle' as long as it is a valid
     'vehicle'


--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search & Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux