Communauté Informatique NDFR.net

Communauté Informatique NDFR.net (http://www.ndfr.net/forums/index.php)
-   Programmation Web (HTML, PHP, ASP, Java, XML, etc.) (http://www.ndfr.net/forums/forumdisplay.php?f=65)
-   -   Aide à la création d'une console d'administration (http://www.ndfr.net/forums/showthread.php?t=7435)

wuub 09-08-2006 17:44

C'est le resultat d'un requete SQL : while($loc_data = mysql_fetch_array($rc))
Code:

        elseif($_POST['send'] == 'update') {

                $path1= "d:/www/.com/img/locations/".$HTTP_POST_FILES['lfile']['name'][0];
                        $path2= "d:/www/.com/img/locations/".$HTTP_POST_FILES['lfile']['name'][1];
                        $path3= "d:/www/.com/img/locations/".$HTTP_POST_FILES['lfile']['name'][2];
                        $path4= "d:/www/.com/img/locations/".$HTTP_POST_FILES['lfile']['name'][3];

                        if ($HTTP_POST_FILES['lfile']['name'][0] == NULL) $HTTP_POST_FILES['lfile']['name'][0] = $loc_data['loc_image_01'];
                                else copy($HTTP_POST_FILES['lfile']['tmp_name'][0], $path1);

                        if ($HTTP_POST_FILES['lfile']['name'][1] == NULL) $HTTP_POST_FILES['lfile']['name'][1] = $loc_data['loc_image_02'];
                                else copy($HTTP_POST_FILES['lfile']['tmp_name'][1], $path2);

                        if ($HTTP_POST_FILES['lfile']['name'][2] == NULL) $HTTP_POST_FILES['lfile']['name'][2] = $loc_data['loc_image_03'];
                                else copy($HTTP_POST_FILES['lfile']['tmp_name'][2], $path3);

                        if ($HTTP_POST_FILES['lfile']['name'][3] == NULL) $HTTP_POST_FILES['lfile']['name'][3] = $loc_data['loc_image_04'];
                                else copy($HTTP_POST_FILES['lfile']['tmp_name'][3], $path4);

                $sql =
                        ' UPDATE locations SET
                          loc_ref = "'                .$_POST['loc_ref'].'"
                        , loc_type = "'                .$_POST['loc_type'].'"
                        , loc_surface = "'        .$_POST['loc_surface'].'"
                        , loc_loggia = "'        .$_POST['loc_loggia'].'"
                        , loc_loyer = "'        .$_POST['loc_loyer'].'"
                        , loc_charges = "'        .$_POST['loc_charges'].' "
                        , loc_frais = "'        .$_POST['loc_frais'].'"
                        , loc_lieu = "'                .$_POST['loc_lieu'].'"
                        , loc_dispo = "'        .$_POST['loc_dispo'].'"
                        , loc_image_01 = "' .$HTTP_POST_FILES['lfile']['name'][0].'"
                        , loc_image_02 = "' .$HTTP_POST_FILES['lfile']['name'][1].'"
                        , loc_image_03 = "' .$HTTP_POST_FILES['lfile']['name'][2].'"
                        , loc_image_04 = "' .$HTTP_POST_FILES['lfile']['name'][3].'"
                        , loc_details = "'        .$_POST['loc_details'].'"
                        WHERE loc_id = "'        .$_POST['loc_id'].'"';


fonji 09-08-2006 17:48

Donne voir la suite de ton code, parce que là je saisis pas trop.

EDIT : nous avons discuté par IM, et j'avais raison de me questionner sur son $loc_data, la boucle était complètement ailleurs, genre rien à voir... :D
Donc bon, la solution que je lui ai proposé c'est de modifier sa requête sql pour que les champs soient mis à jour seulement si il y a une valeur, au lieu d'aller chercher l'ancienne pour la remettre dans un update...
C'est pas très français mais j'suis à moitié malade hun.


All times are GMT +2. The time now is 00:02.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.