@Chesterfield25

Почему выводится предупреждение Warning: Missing argument?

Почему выводится предупреждение Warning: Missing argument…?
5fd3459e052f8044798085.png
А изображения добавляются в столбец с названием pric а не image?
Строка 173 по 185 в action.php
$res = setTypeVehicule($_POST['libelle_type_vehicule'],$_POST['price_vehicule'],$newfilename);
                if($res == 1){
                    $_SESSION['status'] = 1;
                    header('Location: '.$_SERVER['HTTP_REFERER']);
                }else{
                    $_SESSION['status'] = 2;
                    header('Location: '.$_SERVER['HTTP_REFERER']);
                }
            } else {
                //echo "A error has occured uploading.";
                $_SESSION['status'] = 2;
                header('Location: '.$_SERVER['HTTP_REFERER']);
            }


И строки в fonction php с 314 по 433

/* Start Type véhicule */
    function setTypeVehicule($libelle,$prix,$pric,$image){
        include("connexion.php");
        $con->set_charset("utf8");
        $res = '0';
        $libelle = str_replace("'","\'",$libelle);
        $prix = str_replace("'","\'",$prix);
		$pric = str_replace("'","\'",$pric);
        $date_heure = date('Y-m-d H:i:s');

        $sql_verif = "SELECT id FROM tj_type_vehicule WHERE libelle='$libelle'";
        $result_verif = mysqli_query($con,$sql_verif);

        if(mysqli_num_rows($result_verif) > 0){
            $res = '2';
        }else{
            $sql = "INSERT INTO tj_type_vehicule (libelle, creer, prix, pric, image) VALUES ('$libelle', '$date_heure', '$prix', '$pric', '$image')";
            $result = mysqli_query($con,$sql);
            if($result == 1){
                $res = '1';
            } else {
                $res = '0';
            }
        }
        mysqli_close($con);
        return $res;
    }

    function setTypeVehiculeMod($id,$libelle,$prix,$pric,$image){
        include("connexion.php");
        $con->set_charset("utf8");
        $res = '0';
        $libelle = str_replace("'","\'",$libelle);
        $prix = str_replace("'","\'",$prix);
		$pric = str_replace("'","\'",$pric);
        $date_heure = date('Y-m-d H:i:s');

        $sql = "UPDATE tj_type_vehicule SET image='$image', libelle='$libelle', prix='$prix', pric='$pric', modifier='$date_heure' WHERE id=$id";
        $result = mysqli_query($con,$sql);
        
        mysqli_close($con);
        return $res;
    }


    function getTypeVehicule(){
        include("connexion.php");
        $con->set_charset("utf8");
        $sql = "SELECT * FROM tj_type_vehicule";
        $result = mysqli_query($con,$sql);
        // output data of each row
        while($row = mysqli_fetch_assoc($result)) {
            $output[] = $row;
        }
        
        mysqli_close($con);
        if(mysqli_num_rows($result) > 0){
            return $output;
        }else{
            return $output = [];
        }
    }

    function getTypeVehiculeById($id_type){
        include("connexion.php");
        $con->set_charset("utf8");
        $sql = "SELECT * FROM tj_type_vehicule WHERE id=$id_type";
        $result = mysqli_query($con,$sql);
        // output data of each row
        while($row = mysqli_fetch_assoc($result)) {
            $output[] = $row;
        }
        
        mysqli_close($con);
        if(mysqli_num_rows($result) > 0){
            return $output;
        }else{
            return $output = [];
        }
    }

    function getIdTypeVehiculeByLibelle($lib_annee){
        include("connexion.php");
        $con->set_charset("utf8");
        $sql = "SELECT id FROM tj_type_vehicule WHERE libelle='$lib_annee'";
        $result = mysqli_query($con,$sql);
        // output data of each row
        $id = 0;
        while($row = mysqli_fetch_assoc($result)) {
            $id = $row['id'];
        }
        
        mysqli_close($con);
        return $id;
    }

    function delTypeVehicule($id){
        include("connexion.php");
        $con->set_charset("utf8");
        $sql = "DELETE FROM tj_type_vehicule WHERE id=$id";
        $result = mysqli_query($con,$sql);
        mysqli_close($con);
    }

    function getLastTypeVehicule(){
        include("connexion.php");
        $con->set_charset("utf8");
        $sql = "SELECT * FROM tj_type_vehicule ORDER BY id DESC LIMIT 1";
        $result = mysqli_query($con,$sql);
        // output data of each row
        while($row = mysqli_fetch_assoc($result)) {
            $output[] = $row;
        }
        
        mysqli_close($con);
        if(mysqli_num_rows($result) > 0){
            return $output;
        }else{
            return $output = [];
        }
    }
    /* End Type véhicule */
  • Вопрос задан
  • 147 просмотров
Решения вопроса 2
FanatPHP
@FanatPHP
Чебуратор тега РНР
Эта Очень Сложная проблема относится к области арифметики.
Доставай свои счетные палочки, сейчас будем её решать.

Идем в определение функции setTypeVehicule() и считаем сколько в неё надо передать параметров:
$libelle, один
$prix, два
$pric, три
$image четыре!

дальше идем в вызов этой функции, и считаем, сколько на самом деле передаём
$_POST['libelle_type_vehicule'], один
$_POST['price_vehicule'], два
$newfilename три!

Три не равно четыре, а это значит что одного параметра не хватает
Ответ написан
Комментировать
flapflapjack
@flapflapjack
на треть я прав
Ну так у вас функция имеет 4 обязательных аргумента:
function setTypeVehicule($libelle,$prix,$pric,$image) // 4 аргумента на входе


, а вы вызываете ее с тремя:
$res = setTypeVehicule($_POST['libelle_type_vehicule'],$_POST['price_vehicule'],<b>ГДЕ АРГУМЕНТ PRICE?</b>,$newfilename);
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы