Insert 0. OK depuis mysql. KO depuis php

Fermé
Odio - 22 juin 2020 à 17:19
jordane45 Messages postés 38241 Date d'inscription mercredi 22 octobre 2003 Statut Modérateur Dernière intervention 17 septembre 2024 - 22 juin 2020 à 17:31
Bonjour,

J'exécute cette requête.
INSERT INTO t ( a , b , c ) VALUES ( 98 , 'f' , 0 )


Depuis MySQL, j'ai les bonnes données dans la table.
Depuis PHP, j'obtiens 1 dans la colonne 'c'.

J'ai essayé en mettant -1, c'est OK. Il y a donc un problème uniquement avec 0.


SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

CREATE TABLE `t` (
  `id` int(6) NOT NULL,
  `a` int(6) NOT NULL,
  `b` varchar(20) NOT NULL,
  `c` int(2) DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;


ALTER TABLE ``
  ADD PRIMARY KEY (`id`),
  ADD KEY `id` (`id`);

ALTER TABLE `t`
  MODIFY `id` int(6) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=278;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

D'où ça vient?
A voir également:

2 réponses

Chris 94 Messages postés 50978 Date d'inscription mardi 8 janvier 2008 Statut Modérateur Dernière intervention 17 février 2023 7 334
22 juin 2020 à 17:29
0
jordane45 Messages postés 38241 Date d'inscription mercredi 22 octobre 2003 Statut Modérateur Dernière intervention 17 septembre 2024 4 689
22 juin 2020 à 17:31
Bonjour,

Tu nous dis que depuis mysql c'est bon.... et que ton souci se produit avec php.

Il faudrait donc nous montrer ton code php...
0