$adr){ if($adr['nouvelle'] != 'new'){ // test si on vient de creer cette adresse dans verif_adresse.inc.php //construction des bits $statut = ""; if ($adr["secondaire"]) $statut .= 'res-secondaire,'; if ($adr["courrier"]) $statut .= 'courrier,'; if ($adr["active"]) $statut .= 'active,'; if ($adr["temporaire"]) $statut .= 'temporaire,'; if (! empty($statut)) $statut = substr($statut, 0, -1); if ($adr["nouvelle"] == 'ajout') { //nouvelle adresse $globals->xdb->execute("INSERT INTO adresses SET adr1 = {?}, adr2 = {?}, adr3 = {?}, postcode = {?}, city = {?}, cityid = {?}, country = {?}, region = {?}, regiontxt = {?}, tel = {?}, fax = {?}, pub = {?}, tel_pub = {?}, datemaj = NOW(), statut = {?}, uid = {?}, adrid = {?}", $adr['adr1'], $adr['adr2'], $adr['adr3'], $adr['postcode'], $adr['city'], $adr['cityid'], $adr['country'], $adr['region'], $adr['regiontxt'], $adr['tel'], $adr['fax'], $adr['pub'], $adr['tel_pub'], $statut, Session::getInt('uid', -1), $adrid); } else{ //c'est une mise à jour $globals->xdb->execute( "UPDATE adresses SET adr1 = {?}, adr2 = {?}, adr3 = {?}, postcode = {?}, city = {?}, cityid = {?}, country = {?}, region = {?}, regiontxt = {?}, tel = {?}, fax = {?}, pub = {?}, tel_pub = {?}, datemaj = NOW(), statut = {?} WHERE uid = {?} AND adrid = {?}", $adr['adr1'], $adr['adr2'], $adr['adr3'], $adr['postcode'], $adr['city'], $adr['cityid'], $adr['country'], $adr['region'], $adr['regiontxt'], $adr['tel'], $adr['fax'], $adr['pub'], $adr['tel_pub'], $statut, Session::getInt('uid', -1), $adrid ); }// fin nouvelle / ancienne adresse }//fin if nouvellement crée }//fin foreach ?>