|
Posted by Steve on 10/19/06 03:39
"linda" <newsaccount@tiscali.co.uk> wrote in message
news:4536dbd1_3@mk-nntp-2.news.uk.tiscali.com...
|
| "Breklin" <breklin@sbcglobal.net> wrote in message
| news:oGzZg.988$T_1.417@newssvr14.news.prodigy.com...
| > Hi Linda,
| >
| > I wrote you a simple script quite a few posts ago that use both a record
| > id (auto_incremented) and a productid, which you get from your supplier.
| > It seems that Steve agrees with my approach, too, of using both. One is
| > a unique id for the table record you are dealing with which can be used
| > for quick look up in your queries and WHERE statements. The other is for
| > you to validate against it's existence. I do this with several ecom
| > sites I have built and it works great because, if, I am updating a
| > particular record, I will use the auto_incremented 'id' field to update
| > the record data. If I am inserting, I want to make sure that there are
| > no duplicate records for the productid that was manually entered, i can
| > use that to make sure i'm not duplicating that product.
| >
| > See if you can find what I wrote. Otherwise, I'll pound it out again.
| >
| > Cheers.
| >
| Hi Breklin,
|
| I have download it, I haven't had much time today to look at either yours
or
| Steve's, as i'm off for a few days much needed rest as of tomorrow, but I
| have printed both off to take with me. These will no doubt be read whilst
| relaxing under an umbrella in the rain:-0
|
| I have as of tonight, (having given it a lot of thought) come round to the
| idea perhaps I should use a separate Id field, and have now added this.
| Though I must admit I don't fully understand how it would prevent any
| duplicates. But as I have little knowledge on which to base any theory, I
| felt that as those that did were telling me of it's benefit I would listen
| to the voices of experience. And of course I'm going to do some more
reading
| on this particular topic also.
|
| Have a great week, and thank you very much for the helpful code. I will
no
| doubt be back next week with question for you both, that is if you don't
| mind! As I'm sure there will be things I'm not one 100% on.
|
| Kindest regards,
| Linda
|
linda,
breklin has the correct approach and his script is probably more easily
digestable than the one it posted. the unique id you (the auto-incremented)
assign is important as well as the product code itself. it helps you know if
you're updating an existing record with the same product code being used or
if the existing record is the one you're currently editing. anyway, breklin
has covered the based in the script he posted. it may be good to puruse both
and see if you can find where both our scripts handle the same problem.
there's always more than one way to skin a cat, as they say.
cheers
[Back to original message]
|