Gossamer Forum
Home : Products : DBMan SQL : Discussion :

Does anybody know how to validate data to avoid duplication of stored records in a table?

Quote Reply
Does anybody know how to validate data to avoid duplication of stored records in a table?
 
do you know how to validate fields input when adding a record or modifying so the information in the tables cannot be repeatly stored with the same information in diferent id

i mean to prevent this

id | name | lastname | postion |

1 | a | a | a | ok

2 | a | a | a | not ok - (this row is not right or cannot be added)

3 | a | b | a | ok



if you see the 2 row is not right because cannot be the same person with equal name and lastname and position



someone guess me this

I would guess that you need to do some validation in the script after the data has been submitted. Something like this:

my $rows = $db->count ({lastname => $IN->param('lastname'), position => $IN->param('position')});

if ($rows) { ... tell the user this is not valid ...}

else { ... }



but i am still there thinking how do it right
KevinW ANDRE
webmaster@cyberbrickell.com
Subject Author Views Date
Thread Does anybody know how to validate data to avoid duplication of stored records in a table? kevinws 2686 Sep 12, 2003, 3:44 PM
Post Re: [kevinws] Does anybody know how to validate data to avoid duplication of stored records in a table?
kevinws 2575 Sep 13, 2003, 12:46 PM