I am working on a project of my own but I have an issue.
I created a simple table with the query:
$sql_art = "CREATE TABLE articoli (
id INT(3) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
cod_int VARCHAR(6) NOT NULL,
nome VARCHAR(50) NOT NULL,
descr VARCHAR(100) NULL,
cod_barre INT(20) NOT NULL,
prezzo INT(5) NULL,
note VARCHAR(100) NULL,
reg_date TIMESTAMP,
UNIQUE (cod_barre)
)";
when I try to add a new record with
$sql_ins = "INSERT INTO `gestionale_db`.`articoli`
(`id`, `cod_int`, `nome`, `descr`, `cod_barre`, `prezzo`, `note`, `reg_date`)
VALUES
(NULL, 'A001', 'Cazzilli', 'ancora caldi', '4545415615456',
'215', 'su tisi', CURRENT_TIMESTAMP)";
it return the error
#1062 - Duplicate entry '2147483647' for key 'cod_barre'
but obviously cod_barre is not equal to this value.
If I try to modify the record with UPDATE, it modify all the value except cod_barre that remain the same.
By default in php.ini
I use InnoDB
es ENGINE and latin1_swedish_ci
as char_set.
Can anyone help me to find the error?