Bonjour,

A l'intérieur d'une fonction en PHP, j'ai une requête écrite en PostgreSQL comme celle-là :

Code SQL : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
UPDATE
            administration.client
        SET
            nom_client = 'Mon client',
            adresse = '3 rue de l Eglise',
            contact_tel = '033551112',
            contact_mail = 'info@monclient.fr',
            vignette = 'vignette.png',
            applications = ARRAY[1,7],
            maj_client = now()
        WHERE
            id_client = 5

Seulement cette requête passe côté base de données mais pas en PHP. L'update fait que applications passe à null.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
    function updateOne() {
        $sql = "
        UPDATE
            administration.client
        SET
            nom_client = :nom_client,
            adresse = :adresse,
            contact_tel = :contact_tel,
            contact_mail = :contact_mail,
            vignette = :vignette,
            applications = ARRAY[:applications]::smallint[],
            maj_client = now()
        WHERE
            id_client = :id_client
        ";
 
        var_dump($sql);
 
        $query = $this->conn->prepare($sql);
        $query->bindParam(':id_client', $this->id_client, PDO::PARAM_INT);
        $query->bindParam(':nom_client', $this->nom_client, PDO::PARAM_STR);
        $query->bindParam(':adresse', $this->adresse, PDO::PARAM_STR);
        $query->bindParam(':contact_tel', $this->contact_tel, PDO::PARAM_STR);
        $query->bindParam(':contact_mail', $this->contact_mail, PDO::PARAM_STR);
        $query->bindParam(':vignette', $this->vignette, PDO::PARAM_STR);
        $query->bindParam(':applications', $this->application);
Pourquoi ?

Cela provient vraisemblablement du paramètrage de "applications". Lors des quelques tentatives, j'ai mis [1,7] au paramètre applications.

Merci pour vos retours