IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Langage PHP Discussion :

POO tableau sous forme d'objet


Sujet :

Langage PHP

  1. #1
    Membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2007
    Messages
    197
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Yvelines (Île de France)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Conseil

    Informations forums :
    Inscription : Avril 2007
    Messages : 197
    Points : 54
    Points
    54
    Par défaut POO tableau sous forme d'objet
    Bonjour à tous,

    je me suis mis ce jour à la POO.

    Je suis un peu en galère, en fait je récupère un tableau mais ce tableau contient des objets.

    J'ai essayé de l'exploiter de la sorte:

    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
     <?php 
                                foreach($agenda as $element):
     
                                //if($element['action'] == $gestionnaire->getlogin() && $element['date_validation'] == '0000-00-00' && $element['date_action'] < date('Y-m-d')): ?>
                                <tr>
                                    <td>
                                        <?php var_dump($agenda);//echo $agenda->getn_doss(); ; ?>
                                    </td>
                                    <td>
                                        <?php //echo $element['n_doss'] ; ?>
                                    </td>
                                    <td>
                                        <?php //echo $element['description'] ; ?>
                                    </td>
                                    <td>
                                        <img src="images/validate.gif"> <img src="images/edit.gif"> <img src="images/delete.png"> 
                                    </td>
                                </tr>
                                <?php 
                               //endif;
                                endforeach; ?>
    mais bien entendu rien n'y fait, rien n'apparait, j'ai essayé aussi avec les
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    $element['description']
    comme je faisais en procédural mais rien n'apparait.

    lorsque je fais un var_dump($agenda) je reçois cela:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    array(1556) { [191]=> object(agenda)#6 (13) { ["id":"agenda":private]=> string(3) "191" ["id_company":"agenda":private]=> string(1) "1" ["id_gestionnaire":"agenda":private]=> string(1) "0" ["liasse":"agenda":private]=> string(7) "liassea" ["n_doss":"agenda":private]=> string(12) "120015660003" ["code_client":"agenda":private]=> string(4) "1566"
    je ne sais pas du tout comment l'exploiter, c'est mon premier blocage en POO. apparemment cela ne fonctionne pas comme un array classique.

    Toute forme d'aide sera grandement appréciée.

  2. #2
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Points : 44 155
    Points
    44 155
    Par défaut
    par exemple
    N'oubliez pas de consulter les FAQ PHP et les cours et tutoriels PHP

  3. #3
    Membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2007
    Messages
    197
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Yvelines (Île de France)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Conseil

    Informations forums :
    Inscription : Avril 2007
    Messages : 197
    Points : 54
    Points
    54
    Par défaut
    Bonjour,

    merci pour votre retour rapide.

    En fait cela ne met ni message d'erreur, ni rien, pourtant j'ai bien
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    error_reporting(E_ALL & ~(E_STRICT|E_NOTICE));
    Par ailleurs il se trouve que si je met rien j'ai bien toutes mes lignes mais elles sont vides,

    si je met cela j'ai une seule ligne mais également vide et sans message d'erreur.

  4. #4
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Points : 44 155
    Points
    44 155
    Par défaut
    et
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    var_dump($element->n_doss);
    ?
    N'oubliez pas de consulter les FAQ PHP et les cours et tutoriels PHP

  5. #5
    Membre habitué
    Homme Profil pro
    Directeur technique
    Inscrit en
    Février 2011
    Messages
    146
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : Directeur technique
    Secteur : Transports

    Informations forums :
    Inscription : Février 2011
    Messages : 146
    Points : 172
    Points
    172
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    error_reporting(-1);
    ini_set('display_errors', 1);
     
     
    $json = json_encode($agenda);
    $array = json_decode($json, TRUE);
     
    echo '<pre>';
    print_r($array);
    echo '</pre>';

  6. #6
    Membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2007
    Messages
    197
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Yvelines (Île de France)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Conseil

    Informations forums :
    Inscription : Avril 2007
    Messages : 197
    Points : 54
    Points
    54
    Par défaut
    rien n'est affiché avec cela

  7. #7
    Membre habitué
    Homme Profil pro
    Directeur technique
    Inscrit en
    Février 2011
    Messages
    146
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : Directeur technique
    Secteur : Transports

    Informations forums :
    Inscription : Février 2011
    Messages : 146
    Points : 172
    Points
    172
    Par défaut
    avec mon code ou le sien ?

  8. #8
    Membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2007
    Messages
    197
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Yvelines (Île de France)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Conseil

    Informations forums :
    Inscription : Avril 2007
    Messages : 197
    Points : 54
    Points
    54
    Par défaut
    Citation Envoyé par Aurélien LEQUOY Voir le message
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    error_reporting(-1);
    ini_set('display_errors', 1);
     
     
    $json = json_encode($agenda);
    $array = json_decode($json, TRUE);
     
    echo '<pre>';
    print_r($array);
    echo '</pre>';
    je ne veux pas utiliser json.

  9. #9
    Membre habitué
    Homme Profil pro
    Directeur technique
    Inscrit en
    Février 2011
    Messages
    146
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : Directeur technique
    Secteur : Transports

    Informations forums :
    Inscription : Février 2011
    Messages : 146
    Points : 172
    Points
    172
    Par défaut
    si tu peux afficher ce que tu as avec le var_dump avec les options suivantes :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    error_reporting(-1);
    ini_set('display_errors', 1);

    on pourrait davantage t'aider

  10. #10
    Membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2007
    Messages
    197
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Yvelines (Île de France)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Conseil

    Informations forums :
    Inscription : Avril 2007
    Messages : 197
    Points : 54
    Points
    54
    Par défaut
    ça je l'ai déjà rajouté. en dépit de cela j'ai toujours rien qui s'affiche.

  11. #11
    Membre habitué
    Homme Profil pro
    Directeur technique
    Inscrit en
    Février 2011
    Messages
    146
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : Directeur technique
    Secteur : Transports

    Informations forums :
    Inscription : Février 2011
    Messages : 146
    Points : 172
    Points
    172
    Par défaut
    blanace nous ton objet encodé en json afin de faire des test.


    avec

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    echo $agenda->fjghsfgh;

    tu as une erreur au moins ?

  12. #12
    Membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2007
    Messages
    197
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Yvelines (Île de France)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Conseil

    Informations forums :
    Inscription : Avril 2007
    Messages : 197
    Points : 54
    Points
    54
    Par défaut
    non je n'ai pas d'erreur,

    voici mon objet:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    $agenda = Agenda::readarray();
    et ma classe

    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
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    <?php
     
     
    define("AGENDA", "agenda"); 
     
    class agenda {
     
    	private $id;
    	private $id_company;
    	private $id_gestionnaire;
    	private $liasse;
    	private $n_doss;
    	private $code_client;
    	private $qualite;
    	private $code_s;
    	private $libelle;
    	private $action;
    	private $description;
    	private $date_action;
    	private $date_validation;
     
    	public function setid($pArg="0") {$this->id=$pArg;}
    	public function setid_company($pArg="0") {$this->id_company=$pArg;}
    	public function setid_gestionnaire($pArg="0") {$this->id_gestionnaire=$pArg;}
    	public function setliasse($pArg="0") {$this->liasse=$pArg;}
    	public function setn_doss($pArg="0") {$this->n_doss=$pArg;}
    	public function setcode_client($pArg="0") {$this->code_client=$pArg;}
    	public function setqualite($pArg="0") {$this->qualite=$pArg;}
    	public function setcode_s($pArg="0") {$this->code_s=$pArg;}
    	public function setlibelle($pArg="0") {$this->libelle=$pArg;}
    	public function setaction($pArg="0") {$this->action=$pArg;}
    	public function setdescription($pArg="0") {$this->description=$pArg;}
    	public function setdate_action($pArg="0") {$this->date_action=$pArg;}
    	public function setdate_validation($pArg="0") {$this->date_validation=$pArg;}
     
    	public function getid() {return $this->id;}
    	public function getid_company() {return $this->id_company;}
    	public function getid_gestionnaire() {return $this->id_gestionnaire;}
    	public function getliasse() {return $this->liasse;}
    	public function getn_doss() {return $this->n_doss;}
    	public function getcode_client() {return $this->code_client;}
    	public function getqualite() {return $this->qualite;}
    	public function getcode_s() {return $this->code_s;}
    	public function getlibelle() {return $this->libelle;}
    	public function getaction() {return $this->action;}
    	public function getdescription() {return $this->description;}
    	public function getdate_action() {return $this->date_action;}
    	public function getdate_validation() {return $this->date_validation;}
     
    	public function readObject($array = array()) {
    		$qry = "SELECT *".RET."FROM ".AGENDA.RET;
    		$and = "WHERE".RET;
     
    		if($array['id'] != "") {
    			$qry .= $and."id = '".$array['id']."'".RET;
    			$and = "AND".RET;
    		}
     
    		if($array['id_company'] != "") {
    			$qry .= $and."id_company = '".$array['id_company']."'".RET;
    			$and = "AND".RET;
    		}
     
    		if($array['id_gestionnaire'] != "") {
    			$qry .= $and."id_gestionnaire = '".$array['id_gestionnaire']."'".RET;
    			$and = "AND".RET;
    		}
     
    		if($array['liasse'] != "") {
    			$qry .= $and."liasse = '".$array['liasse']."'".RET;
    			$and = "AND".RET;
    		}
     
    		if($array['n_doss'] != "") {
    			$qry .= $and."n_doss = '".$array['n_doss']."'".RET;
    			$and = "AND".RET;
    		}
     
    		if($array['code_client'] != "") {
    			$qry .= $and."code_client = '".$array['code_client']."'".RET;
    			$and = "AND".RET;
    		}
     
    		if($array['qualite'] != "") {
    			$qry .= $and."qualite = '".$array['qualite']."'".RET;
    			$and = "AND".RET;
    		}
     
    		if($array['code_s'] != "") {
    			$qry .= $and."code_s = '".$array['code_s']."'".RET;
    			$and = "AND".RET;
    		}
     
    		if($array['libelle'] != "") {
    			$qry .= $and."libelle = '".$array['libelle']."'".RET;
    			$and = "AND".RET;
    		}
     
    		if($array['action'] != "") {
    			$qry .= $and."action = '".$array['action']."'".RET;
    			$and = "AND".RET;
    		}
     
    		if($array['description'] != "") {
    			$qry .= $and."description = '".$array['description']."'".RET;
    			$and = "AND".RET;
    		}
     
    		if($array['date_action'] != "") {
    			$qry .= $and."date_action = '".$array['date_action']."'".RET;
    			$and = "AND".RET;
    		}
     
    		if($array['date_validation'] != "") {
    			$qry .= $and."date_validation = '".$array['date_validation']."'".RET;
    			$and = "AND".RET;
    		}
     
    		$record = Database::select($qry);
    		if(count($record[0]) == 0) {
    			return array();
    		} else {
    			$record = $record[0];
    			$this->setid($record['id']);
    			$this->setid_company($record['id_company']);
    			$this->setid_gestionnaire($record['id_gestionnaire']);
    			$this->setliasse($record['liasse']);
    			$this->setn_doss($record['n_doss']);
    			$this->setcode_client($record['code_client']);
    			$this->setqualite($record['qualite']);
    			$this->setcode_s($record['code_s']);
    			$this->setlibelle($record['libelle']);
    			$this->setaction($record['action']);
    			$this->setdescription($record['description']);
    			$this->setdate_action($record['date_action']);
    			$this->setdate_validation($record['date_validation']);
    			return true;
    		}
    	}
     
    	public static function readArray($array = array()) {
    		$qry = "SELECT *".RET."FROM ".AGENDA.RET;
    		$and = "WHERE".RET;
     
    		if($array['id'] != "") {
    			$qry .= $and."id = '".$array['id']."'".RET;
    			$and = "AND".RET;
    		}
     
    		if($array['id_company'] != "") {
    			$qry .= $and."id_company = '".$array['id_company']."'".RET;
    			$and = "AND".RET;
    		}
     
    		if($array['id_gestionnaire'] != "") {
    			$qry .= $and."id_gestionnaire = '".$array['id_gestionnaire']."'".RET;
    			$and = "AND".RET;
    		}
     
    		if($array['liasse'] != "") {
    			$qry .= $and."liasse = '".$array['liasse']."'".RET;
    			$and = "AND".RET;
    		}
     
    		if($array['n_doss'] != "") {
    			$qry .= $and."n_doss = '".$array['n_doss']."'".RET;
    			$and = "AND".RET;
    		}
     
    		if($array['code_client'] != "") {
    			$qry .= $and."code_client = '".$array['code_client']."'".RET;
    			$and = "AND".RET;
    		}
     
    		if($array['qualite'] != "") {
    			$qry .= $and."qualite = '".$array['qualite']."'".RET;
    			$and = "AND".RET;
    		}
     
    		if($array['code_s'] != "") {
    			$qry .= $and."code_s = '".$array['code_s']."'".RET;
    			$and = "AND".RET;
    		}
     
    		if($array['libelle'] != "") {
    			$qry .= $and."libelle = '".$array['libelle']."'".RET;
    			$and = "AND".RET;
    		}
     
    		if($array['action'] != "") {
    			$qry .= $and."action = '".$array['action']."'".RET;
    			$and = "AND".RET;
    		}
     
    		if($array['description'] != "") {
    			$qry .= $and."description = '".$array['description']."'".RET;
    			$and = "AND".RET;
    		}
     
    		if($array['date_action'] != "") {
    			$qry .= $and."date_action = '".$array['date_action']."'".RET;
    			$and = "AND".RET;
    		}
     
    		if($array['date_validation'] != "") {
    			$qry .= $and."date_validation = '".$array['date_validation']."'".RET;
    			$and = "AND".RET;
    		}
     
    		$recordset = Database::select($qry);
    		$class_objects = array();
    		if(is_array($recordset) == true) {
    			while(list($i, $record) = each($recordset)) {
    				$class_object = new agenda();
    				$class_object->setid($record['id']);
    				$class_object->setid_company($record['id_company']);
    				$class_object->setid_gestionnaire($record['id_gestionnaire']);
    				$class_object->setliasse($record['liasse']);
    				$class_object->setn_doss($record['n_doss']);
    				$class_object->setcode_client($record['code_client']);
    				$class_object->setqualite($record['qualite']);
    				$class_object->setcode_s($record['code_s']);
    				$class_object->setlibelle($record['libelle']);
    				$class_object->setaction($record['action']);
    				$class_object->setdescription($record['description']);
    				$class_object->setdate_action($record['date_action']);
    				$class_object->setdate_validation($record['date_validation']);
    				$class_objects[$class_object->getid()] = $class_object;
    			}
    		}
    		return $class_objects;
    	}
     
    	public function insert() {
    		if($this->getid() != '') {
    			$qry  = "UPDATE ".AGENDA.RET."SET".RET.
    			"id = '".$this->getid()."',".RET.
    			"id_company = '".$this->getid_company()."',".RET.
    			"id_gestionnaire = '".$this->getid_gestionnaire()."',".RET.
    			"liasse = '".$this->getliasse()."',".RET.
    			"n_doss = '".$this->getn_doss()."',".RET.
    			"code_client = '".$this->getcode_client()."',".RET.
    			"qualite = '".$this->getqualite()."',".RET.
    			"code_s = '".$this->getcode_s()."',".RET.
    			"libelle = '".$this->getlibelle()."',".RET.
    			"action = '".$this->getaction()."',".RET.
    			"description = '".$this->getdescription()."',".RET.
    			"date_action = '".$this->getdate_action()."',".RET.
    			"date_validation = '".$this->getdate_validation()."'".RET.
    			"WHERE id = ".$this->getid().RET;
     
    			Database::insert($qry);
    		} else {
    			$qry  = "INSERT INTO ".AGENDA." (".RET.
    			"id_company, id_gestionnaire, liasse, n_doss, code_client, qualite, code_s, libelle, action, description, date_action, date_validation".RET.
    				") VALUES (".RET.
    			"'".$this->getid_company()."',".RET.
    			"'".$this->getid_gestionnaire()."',".RET.
    			"'".$this->getliasse()."',".RET.
    			"'".$this->getn_doss()."',".RET.
    			"'".$this->getcode_client()."',".RET.
    			"'".$this->getqualite()."',".RET.
    			"'".$this->getcode_s()."',".RET.
    			"'".$this->getlibelle()."',".RET.
    			"'".$this->getaction()."',".RET.
    			"'".$this->getdescription()."',".RET.
    			"'".$this->getdate_action()."',".RET.
    			"'".$this->getdate_validation()."'".RET.
    			")".RET;
     
    			$this->setid(Database::insert($qry));
    		}
    	}
     
    	public static function delete($array = array()) {
    		$qry = "DELETE".RET."FROM ".AGENDA.RET;
    		$and = "WHERE".RET;
     
    		if($array['id'] != "") {
    			$qry .= $and."id = '".$array['id']."'".RET;
    			$and = "AND".RET;
    		}
     
    		if($array['id_company'] != "") {
    			$qry .= $and."id_company = '".$array['id_company']."'".RET;
    			$and = "AND".RET;
    		}
     
    		if($array['id_gestionnaire'] != "") {
    			$qry .= $and."id_gestionnaire = '".$array['id_gestionnaire']."'".RET;
    			$and = "AND".RET;
    		}
     
    		if($array['liasse'] != "") {
    			$qry .= $and."liasse = '".$array['liasse']."'".RET;
    			$and = "AND".RET;
    		}
     
    		if($array['n_doss'] != "") {
    			$qry .= $and."n_doss = '".$array['n_doss']."'".RET;
    			$and = "AND".RET;
    		}
     
    		if($array['code_client'] != "") {
    			$qry .= $and."code_client = '".$array['code_client']."'".RET;
    			$and = "AND".RET;
    		}
     
    		if($array['qualite'] != "") {
    			$qry .= $and."qualite = '".$array['qualite']."'".RET;
    			$and = "AND".RET;
    		}
     
    		if($array['code_s'] != "") {
    			$qry .= $and."code_s = '".$array['code_s']."'".RET;
    			$and = "AND".RET;
    		}
     
    		if($array['libelle'] != "") {
    			$qry .= $and."libelle = '".$array['libelle']."'".RET;
    			$and = "AND".RET;
    		}
     
    		if($array['action'] != "") {
    			$qry .= $and."action = '".$array['action']."'".RET;
    			$and = "AND".RET;
    		}
     
    		if($array['description'] != "") {
    			$qry .= $and."description = '".$array['description']."'".RET;
    			$and = "AND".RET;
    		}
     
    		if($array['date_action'] != "") {
    			$qry .= $and."date_action = '".$array['date_action']."'".RET;
    			$and = "AND".RET;
    		}
     
    		if($array['date_validation'] != "") {
    			$qry .= $and."date_validation = '".$array['date_validation']."'".RET;
    			$and = "AND".RET;
    		}
     
    		Database::delete($qry);
    	}
    }
     
    ?>
    juste pour ne pas me répéter, je ne travaille pas avec json, j'encode rien en json, je travail juste en POO.

  13. #13
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Points : 44 155
    Points
    44 155
    Par défaut
    Juste pour qu'on soit bien sur le même creneau, tu peux dire ce que tu as avec :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
     
    echo 'Agenda<pre>';
    var_dump($agenda);
    echo '</pre>';
    foreach($agenda as $element) {
    echo 'Element<pre>';
       var_dump($element);
    echo '</pre>';
    echo 'ID<pre>';
       var_dump($element->id);
    echo '</pre>';
    }
    N'oubliez pas de consulter les FAQ PHP et les cours et tutoriels PHP

  14. #14
    Membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2007
    Messages
    197
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Yvelines (Île de France)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Conseil

    Informations forums :
    Inscription : Avril 2007
    Messages : 197
    Points : 54
    Points
    54
    Par défaut
    Bonjour,

    merci de votre retour,

    avec votre code voici ce qui apparaît

    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
    27
    28
    29
      [192]=>
      object(agenda)#6 (13) {
        ["id":"agenda":private]=>
        string(3) "192"
        ["id_company":"agenda":private]=>
        string(1) "1"
        ["id_gestionnaire":"agenda":private]=>
        string(1) "0"
        ["liasse":"agenda":private]=>
        string(7) "liassea"
        ["n_doss":"agenda":private]=>
        string(12) "120015660003"
        ["code_client":"agenda":private]=>
        string(4) "1566"
        ["qualite":"agenda":private]=>
        string(19) "Principal"
        ["code_s":"agenda":private]=>
        string(2) "9F"
        ["libelle":"agenda":private]=>
        string(32) "VISITE DOMICILIAIRE"
        ["action":"agenda":private]=>
        string(7) "RELANC2"
        ["description":"agenda":private]=>
        string(23) "seconde relance"
        ["date_action":"agenda":private]=>
        string(10) "2012-09-17"
        ["date_validation":"agenda":private]=>
        string(10) "0000-00-00"
      }

  15. #15
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Points : 44 155
    Points
    44 155
    Par défaut
    Mon n'apparait pas ?
    N'oubliez pas de consulter les FAQ PHP et les cours et tutoriels PHP

  16. #16
    Membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2007
    Messages
    197
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Yvelines (Île de France)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Conseil

    Informations forums :
    Inscription : Avril 2007
    Messages : 197
    Points : 54
    Points
    54
    Par défaut
    si, j'ai oublié de copier/coller cette partie
    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
    27
    28
    29
    30
    31
    32
     
    Agenda
    array(1556) {
      [191]=>
      object(agenda)#5 (13) {
        ["id":"agenda":private]=>
        string(3) "191"
        ["id_company":"agenda":private]=>
        string(1) "1"
        ["id_gestionnaire":"agenda":private]=>
        string(1) "0"
        ["liasse":"agenda":private]=>
        string(7) "liassea"
        ["n_doss":"agenda":private]=>
        string(12) "120015660003"
        ["code_client":"agenda":private]=>
        string(4) "1566"
        ["qualite":"agenda":private]=>
        string(19) "Principal"
        ["code_s":"agenda":private]=>
        string(2) "9F"
        ["libelle":"agenda":private]=>
        string(32) "VISITE DOMICILIAIRE"
        ["action":"agenda":private]=>
        string(7) "PLETTRE"
        ["description":"agenda":private]=>
        string(13) "1relance"
        ["date_action":"agenda":private]=>
        string(10) "2012-09-07"
        ["date_validation":"agenda":private]=>
        string(10) "0000-00-00"
      }

  17. #17
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Points : 44 155
    Points
    44 155
    Par défaut
    Donc on ne rentre pas dans le foreach ...
    Il doit y avoir un truc evident qu'on rate.

    Tu peux essayer :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    echo 'Agenda[191]<pre>';
    var_dump($agenda[191]);
    echo '</pre>';
    N'oubliez pas de consulter les FAQ PHP et les cours et tutoriels PHP

  18. #18
    Membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2007
    Messages
    197
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Yvelines (Île de France)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Conseil

    Informations forums :
    Inscription : Avril 2007
    Messages : 197
    Points : 54
    Points
    54
    Par défaut
    si on rentre dans le foreach mais tout mettre eu été trop long (plus de 12000 enregistrements)

  19. #19
    Membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2007
    Messages
    197
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Yvelines (Île de France)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Conseil

    Informations forums :
    Inscription : Avril 2007
    Messages : 197
    Points : 54
    Points
    54
    Par défaut
    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
    27
    28
    29
    Agenda[191]
    object(agenda)#5 (13) {
      ["id":"agenda":private]=>
      string(3) "191"
      ["id_company":"agenda":private]=>
      string(1) "1"
      ["id_gestionnaire":"agenda":private]=>
      string(1) "0"
      ["liasse":"agenda":private]=>
      string(7) "liassea"
      ["n_doss":"agenda":private]=>
      string(12) "120015660003"
      ["code_client":"agenda":private]=>
      string(4) "1566"
      ["qualite":"agenda":private]=>
      string(19) "Principal"
      ["code_s":"agenda":private]=>
      string(2) "9F"
      ["libelle":"agenda":private]=>
      string(32) "DOMICILIAIRE"
      ["action":"agenda":private]=>
      string(7) "PLETTRE"
      ["description":"agenda":private]=>
      string(13) "1 relance"
      ["date_action":"agenda":private]=>
      string(10) "2012-09-07"
      ["date_validation":"agenda":private]=>
      string(10) "0000-00-00"
    }

  20. #20
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Points : 44 155
    Points
    44 155
    Par défaut
    Si depuis le début tu ne donnes que la moitié des informations, ca ne m’etonne pas qu'on tourne en rond.

    Donc ça fonctionne ?
    N'oubliez pas de consulter les FAQ PHP et les cours et tutoriels PHP

Discussions similaires

  1. Mettre un tableau sous forme de texte
    Par oliv380 dans le forum VBA Word
    Réponses: 3
    Dernier message: 13/09/2010, 19h16
  2. Afficher le contenu d'un tableau sous forme de lien
    Par vivicente dans le forum Langage
    Réponses: 1
    Dernier message: 06/10/2009, 17h34
  3. Impossible d'afficher le tableau sous forme de grille
    Par *alexandre* dans le forum SharePoint
    Réponses: 1
    Dernier message: 22/07/2009, 08h52
  4. [Tableaux] Exporter un tableau sous forme d'image
    Par debutanteVB.NET dans le forum Langage
    Réponses: 2
    Dernier message: 27/10/2008, 11h35

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo