Colleagues, please tell me what I’m doing wrong.
I need to make entries in the database table. It has a primary key - it is an auto-increment type field int. After making a record, I need to return to this record. So I want to keep the primary key value of this record.
To do this, I read the key value after writing. Like this:
same => n,MySQL(Connect connid localhost asterisk XXXXXXXXXXX MyBASE)
same => n,MySQL(Query resultid ${connid} INSERT INTO `mytable` ...)
same => n,MySQL(Query resultid ${connid} SELECT LAST_INSERT_ID())
Writing to the table is fine, but unfortunately, the readed value of uniq id is always two. Do not understand why.
The table itself is created correctly and all the necessary information is set.
CREATE TABLE `mytable` (
`id` int(11) NOT NULL AUTO_INCREMENT,
...
PRIMARY KEY (id)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
What am I doing wrong, tell me, please.
Ogogon.