- Jul 15, 2001
- 6,899
- 63
- 91
Writing a script that reads a log file and parses some data from it.(this part works) Now I want to insert that data into a database that I created. The table design is:
XXX(PK) y1 y2 y3 y4 x1
Now there cant be more than one xxx, however for each xxx there can be different y. So if the table is empty then I can put in xxx and the first instance of y into y1. If xxx comes again then i want to avoid inserting it (to avoid sql error) and check if y =y1. If it is then I will be done, if not then put it in y2, etc. I am trying to implement the first part (avoid inserting xxx more than once) and am having some diffculties.
I have tried many variations of this but none seem to stop the xxx from being inserted multiple times. st execute failed: Duplicate entry 'sdfsd' for key 1 at ./test.cgi line 72 is the error i get
XXX(PK) y1 y2 y3 y4 x1
Now there cant be more than one xxx, however for each xxx there can be different y. So if the table is empty then I can put in xxx and the first instance of y into y1. If xxx comes again then i want to avoid inserting it (to avoid sql error) and check if y =y1. If it is then I will be done, if not then put it in y2, etc. I am trying to implement the first part (avoid inserting xxx more than once) and am having some diffculties.
I have tried many variations of this but none seem to stop the xxx from being inserted multiple times. st execute failed: Duplicate entry 'sdfsd' for key 1 at ./test.cgi line 72 is the error i get