many thanks - (I actually have three tables to amend two of which have
more than 2 fields).
I ended up doing this:
added three yes/no fields - one for update, one for insert, and one to say
whether or not to show the entry
set all entries to No before an update/insert
then if an update set the update and show yes/no fields to Yes
and if insert set the insert and show yes/no fields to Yes
This seems to work quite well - I have no idea whether or not it is elegant
or not.
Any opinions on this would be most welcome.
The only problem is that currently the update process updates anything that
matches the ID code in both the old database and the new list. So I don't
actually know if it has really been updated (ie not just overwritten).
I'm updating an existing site done in php and the previous program sent the
owner back a list of titles inserted, updated, and deleted. These figures
did not include titles that remained the same - I can't work out to do this
- surely it would mean looping thru every field in every entry, which even
if I could work how to do (which I can't) would seem like a huge amount of
work???
The database is for a remainder (discounted) book distributor and quite
often they will get the same books in again after 6 months or so; I thought
that deleting entries would probably not be the way to go.
Also I thought that generally deleting entries from a database was not best
practice???
Is this not frowned upon??
I'm actually having problems working out stuff with bulk updating/inserting
- I can't find any tutorials or books that go into any details. Do you or
anyone else know of anywhere I can learn more on this.
Again thanks for your help and any further help or suggestions are
extremely welcome.
Seamus
At 07:18 pm 10/06/01 , you wrote:
>Seamus,
>
>Option #1: Simply delete everything in the database and then add
>everything in
>the new group list. No need for updates. You can get away with this because
>the new group list contains all of the fields (i.e. 2) in the database table,
>if I read you right.
>
>Option #2: Remove items in-the-database-but-not-on-the-new-group-list
>*before*
>you loop over the list. There are two ways to do this:
>(a) Make a query for everything in the database table. Loop over this query
>and see if the current row is in the new group list. If not, delete it.
>(b) If you can get all of the new group list's primary keys at once, you
>can do
>all of the deletions at once. If GroupCode is the primary key:
> delete from tblGroupCopy where GroupCode not in (new-group-list-GroupCodes)
>
>-David
>
>On Thursday, June 07, 2001 Seamus Campbell [SMTP:[EMAIL PROTECTED]] wrote:
> > However I cannot work out how to account for items originally on
> database but
> > not on new group list i.e. groups that need to be deleted from original
>database
> > after update process.
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists