mysql: troubles with insert

Henk van der Velden henk at iglow-media.nl
Thu Jul 19 17:33:34 EDT 2007


Good day all,

I'm having some troubles with inserting new records into a MySQL table.
The table consists of a number of columns, the first of which is a  
primary key (the id).
The table contains records with id's from 1 to 20. Some of the  
intermediate id's are missing, due to deleted records.

I want to add a new record with id=21.
This is my code:
     put "INSERT INTO g2_Entity() VALUES(:1,:2,:3,:4,:2,:3,:5,:4)"  
into tsql
     revExecuteSQL tConnection,tsql,"vars" -- puts "11" into g_id??
"Vars" is an array: Vars[1] = 21.
The above code inserts a new item into the table, but instead of  
setting the id of the new record to 21, it sets it to 11. 11 happens  
to be one of the missing / deleted record id's.

When I want to add another record, I get an error message because  
there is already a key with value 11 in the first column.

Can anyone tell me what's going on here?

Henk v.d. Velden
iGlow Media
Utrecht, Netherlands


More information about the use-livecode mailing list