Reply to Re: on input form showing error message for duplicate entry.

Your name:

Reply:


Posted by Breklin on 10/19/06 00:30

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.

linda wrote:
> "Steve" <no.one@example.com> wrote in message
> news:9DqZg.525$_z4.403@newsfe07.lga...
>
>> | I am very grateful for you useful comments, suggestions and examples of
>> | code. Truly I am! I have downloaded and kept all suggestions in my
>> review
>> | codes folder. And will be spending the week end dissecting and working
>> out
>> | what does what, how and why. But please don't argue any more. I feel
>> | awful that I've been the cause of such discourse. The newsgroup seemed
>> | quite peaceful until I came along.
>>
>> linda, i'm sorry this thread has become so muttled. i took offense at
>> ikciu
>> calling you stupid. and the 'solution' he offered didn't even apply to
>> your
>> question. he has yet to consider it fully. he does this in MOST of the
>> threads he responds to. i was tired of it, so i called him on his behavior
>> and lack of care in the posts he actually 'tries' to help with. again,
>> sorry
>> it all came out here.
>>
>>
>
> Hi Steve,
>
> It's ok, I realise that people have a right to air their POV, I just felt
> slightly bad that I it was due to something I enquired about!
> I took no offense to being called stupid, (in fact lol as I stated, I didn't
> even realise I'd been called it) besides I've been using the net since the
> very early days, and have been called it often, who hasn't? It flys right
> over my head, I know I'm an accomplished woman and that's all that matters
> to me. ;-)
>
>
>
>
>> | a) The product code is the ID, this is beyond my control as the products
>> | come from the supplier with these codes on. Yes I realise I could have
>> set
>> | id to auto_increment, and then have another field for the product code,
>> but
>> | I thought that as certain products HAVE TO HAVE a unique code it would
>> be
>> | just a waste having an id field with auto_increment. Besides which it
>> would
>> | be the product code that would be used for searching the data base, so i
>> | decided this would be set to primary and unique.
>>
>> that is a great start, however without another unique id, there is no way
>> to
>> tell that product 'abc' has been edited and the code changed to
>> 'def'...when
>> 'def' already existed. this means you will overwrite the original 'def'
>> record. the auto_increment id on the table IS needed, but far from a
>> stand-alone solution - as ikciu would have you believe.
>>
>
> Will the unique on ID not be enough? I haven't had a chance to study your
> code in full as yet, I'm off for a few days so have now printed and decided
> to take it away with me as light reading. ;-)
> I'm sure I'll understand the above statement once I have had a chance to
> digest it.
>
>
>
>> | b) The reason for needing error reporting on duplicate entries is due to
>> the
>> | fact that I CAN'T have two or more product codes with the same id. But
>> I
>> | also wanted the person inputting the data to realise that, the product
>> code
>> | they entered already existed, (a wake up and smell the coffee moment) so
>> go
>> | back and correct this!
>>
>> that is the way i understood you as well. the sql statement in the example
>> i
>> gave checks if PERSONEXISTS based on an auto_incremented id and the
>> userName. you'd simply be using the auto_incremented id and the
>> productCode
>> for PRODUCTEXISTS and going from there.
>>
>> | That's it pure and simple!
>>
>>
>> best of luck.
>>
>
> Many thanks!
> Have a good week/end, & kindest regards,
> Linda
>
>
>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация