Hi,
i have a problem with auto_increment.
I'm using a for loop to make some inserts in my table.
for (i=0;i<zeit;i++) {
number++;
if (tag == 0) {
sql.exec ("INSERT INTO table (LFDNR,Tag,dtl_bloecke,dtl_tag) VALUES("+LFDNR+","+id+",'','So.')");
}
if (tag == 1) {
sql.exec ("INSERT INTO table (LFDNR,Tag,dtl_bloecke,dtl_tag) VALUES("+LFDNR+","+id+",'','Mo.')");
}
if (tag == 2) {
sql.exec ("INSERT INTO table (LFDNR,Tag,dtl_bloecke,dtl_tag) VALUES("+LFDNR+","+id+",'','Di.')");
}
if (tag == 3) {
sql.exec ("INSERT INTO table (LFDNR,Tag,dtl_bloecke,dtl_tag) VALUES("+LFDNR+","+id+",'','Mi.')");
}
if (tag == 4) {
sql.exec ("INSERT INTO table (LFDNR,Tag,dtl_bloecke,dtl_tag) VALUES("+LFDNR+","+id+",'','Do.')");
}
if (tag == 5) {
sql.exec ("INSERT INTO table (LFDNR,Tag,dtl_bloecke,dtl_tag) VALUES("+LFDNR+","+id+",'','Fr.')");
}
if (tag == 6) {
tag = -1;
sql.exec ("INSERT INTO table (LFDNR,Tag,dtl_bloecke,dtl_tag) VALUES("+LFDNR+","+id+",'','Sa.')");
}
tag++;
LFDNR++;
}
Another field "ID_RECORD" should be my id. In the table ID_RECORD is a primary key with LFDNR and Tag. And has a auto_increment.
I tested the script with zeit = 4, So the loop makes 4 entrys in the table.
The Problem is "ID_RECORD" is on every entry 1.
If i make 4 new entrys after this "ID_RECORD" is on the 4 new entrys 2.
so in the table ther is
ID_RECORD
1
1
1
1
2
2
2
2
instead of
ID_RECORD
1
2
3
4
5
6
7
8
Has anyone ideas how i can solve the problem?