Слишком мало аргументов для функции Livestreams_model :: checkUrlExists () error - PullRequest
0 голосов
/ 21 апреля 2020

Привет, я получаю эту ошибку, когда я пытаюсь добавить ссылку на поток. Сообщение: слишком мало аргументов для функции Livestreams_model :: checkUrlExists (), 1 передано в / var / www/html/application/models/Livestreams_model.php в строке 59 и ровно 2 ожидаемых

Я не знаю, что я делаю не так, может кто-нибудь, пожалуйста, помогите мне?

Я создаю приложение с потоковой передачей

 An uncaught Exception was encountered
Type: ArgumentCountError

Message: Too few arguments to function Livestreams_model::checkUrlExists(), 1 passed in /var/www/html/application/models/Livestreams_model.php on line 59 and exactly 2 expected

Filename: /var/www/html/application/models/Livestreams_model.php

Line Number: 45

Это мой действительный код php

<?php


class Livestreams_model extends CI_Model{
    public $status = 'error';
    public $message = 'Error processing requested operation.';
    public $user = "";

    function __construct(){
       parent::__construct();
      }

   function livestreamsListing(){
       $this->db->select('tbl_live_streams.*');
       $this->db->from('tbl_live_streams');
       $this->db->order_by('dateStarted','ASC');
       $query = $this->db->get();
       return $query->result();
   }

   public function fetchLiveStreams(){
     $this->db->select('tbl_live_streams.*');
     $this->db->from('tbl_live_streams');
     $this->db->order_by('dateStarted','desc');
      $query = $this->db->get();
     return $query->result();
   }

   function getLiveStreamInfo($id)
   {
     $this->db->select('tbl_live_streams.*');
     $this->db->from('tbl_live_streams');
     $this->db->where('tbl_live_streams.id', $id);
     $query = $this->db->get();
    return $query->row();
   }


   function checkUrlExists($url,$id){
       $this->db->select("source");
       $this->db->from("tbl_live_streams");
       $this->db->where("source", $url);
       if($id!=0){
         $this->db->where("id !=", $id);
       }
       $query = $this->db->get();
       return $query->result();
   }


   function addNewLiveStream($info)
   {
     if(empty($this->checkUrlExists($info['source']))){
       $this->db->trans_start();
       $info['dateStarted'] = date('Y-m-d H:i:s');
       $this->db->insert('tbl_live_streams', $info);
       $this->db->trans_complete();
       $this->status = 'ok';
       $this->message = 'Livestream started successfully';
     }else{
       $this->status = 'error';
       $this->message = 'Livestream already started';
     }
   }

   function editlLiveStream($info, $id){
     if(empty($this->checkUrlExists($info['source'],$id))){
       $this->db->where('id', $id);
       $this->db->update('tbl_live_streams', $info);
       $this->status = 'ok';
       $this->message = 'LiveTv edited successfully';
     }else{
       $this->status = 'error';
       $this->message = 'LiveTv already exists';
     }
   }

   function deleteLivestream($id){
       $this->db->where('id', $id);
       $this->db->delete('tbl_live_streams');
        $this->status = 'ok';
        $this->message = 'Livestream deleted successfully.';
   }
}

Большое спасибо

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...