Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何在codeigniter中从视图控制器模型传递值?错误:缺少参数和未定义的变量_Php_Codeigniter - Fatal编程技术网

Php 如何在codeigniter中从视图控制器模型传递值?错误:缺少参数和未定义的变量

Php 如何在codeigniter中从视图控制器模型传递值?错误:缺少参数和未定义的变量,php,codeigniter,Php,Codeigniter,我是ci框架的新手,所以请您帮助我。我不确定我是否正确地从视图控制器模型传递了值,所以请仔细地给我们反馈,这样我的问题就解决了,我得到的错误如下 1)Severity:warning MISSING ARGUMENT 9 FOR searchresultss::login 2)severity:notice Undefined variable 这是控制器页面 $look = $this->input->post('gender'); $age = $this->inp

我是ci框架的新手,所以请您帮助我。我不确定我是否正确地从视图控制器模型传递了值,所以请仔细地给我们反馈,这样我的问题就解决了,我得到的错误如下

1)Severity:warning MISSING ARGUMENT 9 FOR searchresultss::login 
2)severity:notice  Undefined variable 
这是控制器页面

$look = $this->input->post('gender');
$age = $this->input->post('age');
$se_ct = $this->input->post('sect');
$subsect = $this->input->post('subsect');
$coun_try = $this->input->post('country');
$sta_te = $this->input->post('state');
$ci_ty = $this->input->post('city');
$qualification = $this->input->post('qualification');
$data['showdata']   =   $this->searchresultss->login($look,$age,$se_ct,$subsect,$coun_try, $sta_te, $ci_ty,$qualification);
$this->load->view('searchresult',$data);
function login($per_page=3,$look,$age,$se_ct,$subsect,$coun_try, $sta_te, $ci_ty,$qualification)
 {


$query="SELECT *
FROM users
WHERE  

if('$se_ct'!='',sect =  '$se_ct' AND if('$subsect' !='',subsect =  '$subsect',subsect like  '%%'),sect like  '%%' AND subsect like  '%%')
AND
IF( '$cou_ntry' !='', country =  '$cou_ntry'
AND 
if('$sta_te' !='', state =  '$sta_te'
AND  
if('$ci_ty' !='',city =  '$ci_ty',city like  '%%'),state LIKE  '%%'
AND city LIKE  '%%'), country LIKE  '%%'
AND state LIKE  '%%'
AND city LIKE  '%%' ) 
AND age >=  '$age_from'
AND age <=  '$age_to'
AND 
IF('$qualification' !='',qualification =  '$qualification',  qualification LIKE  '%%' ) 
AND gender =  '$look'
And status='1'";
$data=array();
$query=$this->db->query($query);
$data['results']=$query->result();
$data['count']=$query->num_rows();
$data['pages']=ceil($count/$per_page);

return $data;
 }
<form action="<?php echo base_url();?>searchresult/users" method="post">
        <div id="tab1" class="tab_content" >

        <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>Looking for</td>
    <td>
    <input type="radio" name="look" id="look" value="female" checked="checked"/> <span style="color:#000000;">Bride</span> <input type="radio" name="look" id="look" value="male" /><span style="color:#000000;"> Groom</span></td>
  </tr>
  <tr>
    <td>Age</td>
    <td> <span style="color:#000000;">From </span>
         <select name="age_from" id="age" class="inp_age"   >
    <option>18</option>
    <option>19</option>
<option selected>20</option>
<option>21</option>
<option>22</option>
</select><span style="color:#000000;">&nbsp; To</span>
                     <select name="age_to" id="age" class="inp_age"   >
       <option>18</option>
    <option>19</option>
<option >20</option>
<option>21</option>
<option>22</option>
<option>23</option>

<option selected="selected">70</option>
          </select>
         </td>
  </tr>
  <tr>
    <td>Sect</td>
    <td><select name="sect" id="sect" onchange="return SelectSect(this.value);" class="inp_search" >
  <!-- <select name="cont" id="cont" onchange="return SelectState(this.value);" class="inp">-->
          <option value="">Any sect</option>
            <?php
         $sect=mysql_query("select sect_id,sect_name from `geo_sect` order by sect_name asc");
         while($sects=mysql_fetch_array($sect))
         {
         ?>
   <option value="<?php echo $sects['sect_id'];?>"><?php echo $sects['sect_name'];?></option>
         <?php
         }
         ?>

           </select></td>
  </tr>
 <tr>
    <td>Sub Sect</td>
    <td><select name="subsect" id="subsect"  onchange="return SelectSub(this.value);" class="inp_search" >
<!--<select name="state" id="state"  onchange="return SelectCity(this.value);" class="inp" >-->
         <option value="">Any subsect</option>

           </select></td>
  </tr>
  <tr>
    <td>Country</td>
    <td> <select name="country" id="country" onchange="return SelectState(this.value);" class="inp_search">
         <option value="">Any Country</option>
         <?php
         $countries=mysql_query("select country_id,Country_name from `kk.geo_countries` order by Country_name asc");
         while($country=mysql_fetch_array($countries))
         {
         ?>
          <option value="<?php echo $country['country_id'];?>" style="width:10px"><?php echo $country['Country_name'];?></option>
          <?php
          }
          ?>
           </select></td>
  </tr>
  <tr>
    <td>State</td>
    <td><select name="state" id="state"  onchange="return SelectCity(this.value);" class="inp_search" >
         <option value="">Any state</option>

           </select></td>
  </tr>
  <tr>
    <td>City</td>
    <td> <select name="city" id="city" class="inp_search" >
         <option value="">Any city</option>

          </select></td>
  </tr>
  <tr>
    <td>Qualification</td>
    <td><select name="qualification" id="qualification"  class="inp_search" >
     <option value="">Any  qualification</option>
        <?php
         $qualification=mysql_query("select qualification_id,qualification from `qualification` order by qualification asc");
         while($qualifications=mysql_fetch_array($qualification))
         {
         ?>
          <option value="<?php echo $qualifications['qualification_id'];?>"><?php echo $qualifications['qualification'];?></option>
          <?php
          }
          ?>



           </select></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>  <div style="padding-left:100px;"> <input type="submit" name="submit" class="button green search_btn" value="Search" /></div></td>
  </tr>
</table>

    </div>


        </form>
此mi我的型号页面

$look = $this->input->post('gender');
$age = $this->input->post('age');
$se_ct = $this->input->post('sect');
$subsect = $this->input->post('subsect');
$coun_try = $this->input->post('country');
$sta_te = $this->input->post('state');
$ci_ty = $this->input->post('city');
$qualification = $this->input->post('qualification');
$data['showdata']   =   $this->searchresultss->login($look,$age,$se_ct,$subsect,$coun_try, $sta_te, $ci_ty,$qualification);
$this->load->view('searchresult',$data);
function login($per_page=3,$look,$age,$se_ct,$subsect,$coun_try, $sta_te, $ci_ty,$qualification)
 {


$query="SELECT *
FROM users
WHERE  

if('$se_ct'!='',sect =  '$se_ct' AND if('$subsect' !='',subsect =  '$subsect',subsect like  '%%'),sect like  '%%' AND subsect like  '%%')
AND
IF( '$cou_ntry' !='', country =  '$cou_ntry'
AND 
if('$sta_te' !='', state =  '$sta_te'
AND  
if('$ci_ty' !='',city =  '$ci_ty',city like  '%%'),state LIKE  '%%'
AND city LIKE  '%%'), country LIKE  '%%'
AND state LIKE  '%%'
AND city LIKE  '%%' ) 
AND age >=  '$age_from'
AND age <=  '$age_to'
AND 
IF('$qualification' !='',qualification =  '$qualification',  qualification LIKE  '%%' ) 
AND gender =  '$look'
And status='1'";
$data=array();
$query=$this->db->query($query);
$data['results']=$query->result();
$data['count']=$query->num_rows();
$data['pages']=ceil($count/$per_page);

return $data;
 }
<form action="<?php echo base_url();?>searchresult/users" method="post">
        <div id="tab1" class="tab_content" >

        <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>Looking for</td>
    <td>
    <input type="radio" name="look" id="look" value="female" checked="checked"/> <span style="color:#000000;">Bride</span> <input type="radio" name="look" id="look" value="male" /><span style="color:#000000;"> Groom</span></td>
  </tr>
  <tr>
    <td>Age</td>
    <td> <span style="color:#000000;">From </span>
         <select name="age_from" id="age" class="inp_age"   >
    <option>18</option>
    <option>19</option>
<option selected>20</option>
<option>21</option>
<option>22</option>
</select><span style="color:#000000;">&nbsp; To</span>
                     <select name="age_to" id="age" class="inp_age"   >
       <option>18</option>
    <option>19</option>
<option >20</option>
<option>21</option>
<option>22</option>
<option>23</option>

<option selected="selected">70</option>
          </select>
         </td>
  </tr>
  <tr>
    <td>Sect</td>
    <td><select name="sect" id="sect" onchange="return SelectSect(this.value);" class="inp_search" >
  <!-- <select name="cont" id="cont" onchange="return SelectState(this.value);" class="inp">-->
          <option value="">Any sect</option>
            <?php
         $sect=mysql_query("select sect_id,sect_name from `geo_sect` order by sect_name asc");
         while($sects=mysql_fetch_array($sect))
         {
         ?>
   <option value="<?php echo $sects['sect_id'];?>"><?php echo $sects['sect_name'];?></option>
         <?php
         }
         ?>

           </select></td>
  </tr>
 <tr>
    <td>Sub Sect</td>
    <td><select name="subsect" id="subsect"  onchange="return SelectSub(this.value);" class="inp_search" >
<!--<select name="state" id="state"  onchange="return SelectCity(this.value);" class="inp" >-->
         <option value="">Any subsect</option>

           </select></td>
  </tr>
  <tr>
    <td>Country</td>
    <td> <select name="country" id="country" onchange="return SelectState(this.value);" class="inp_search">
         <option value="">Any Country</option>
         <?php
         $countries=mysql_query("select country_id,Country_name from `kk.geo_countries` order by Country_name asc");
         while($country=mysql_fetch_array($countries))
         {
         ?>
          <option value="<?php echo $country['country_id'];?>" style="width:10px"><?php echo $country['Country_name'];?></option>
          <?php
          }
          ?>
           </select></td>
  </tr>
  <tr>
    <td>State</td>
    <td><select name="state" id="state"  onchange="return SelectCity(this.value);" class="inp_search" >
         <option value="">Any state</option>

           </select></td>
  </tr>
  <tr>
    <td>City</td>
    <td> <select name="city" id="city" class="inp_search" >
         <option value="">Any city</option>

          </select></td>
  </tr>
  <tr>
    <td>Qualification</td>
    <td><select name="qualification" id="qualification"  class="inp_search" >
     <option value="">Any  qualification</option>
        <?php
         $qualification=mysql_query("select qualification_id,qualification from `qualification` order by qualification asc");
         while($qualifications=mysql_fetch_array($qualification))
         {
         ?>
          <option value="<?php echo $qualifications['qualification_id'];?>"><?php echo $qualifications['qualification'];?></option>
          <?php
          }
          ?>



           </select></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>  <div style="padding-left:100px;"> <input type="submit" name="submit" class="button green search_btn" value="Search" /></div></td>
  </tr>
</table>

    </div>


        </form>

无法找到错误的位置,请帮助我在控制器功能中添加一个参数

$data['showdata']   =   $this->searchresultss-> login($per_page=3,$look,$age,$se_ct,$subsect,$coun_try, $sta_te, $ci_ty,$qualification);
模型应该是这样的

model function login($per_page,$look,$age,$se_ct,$subsect,$coun_try, $sta_te, $ci_ty,$qualification)

调用函数时,您错过了控制器中的参数。如果您需要什么,请告诉我。

严重性:注意未定义的变量:cou\n try,age\u from,age\u to,count where is is mist not get idea请帮助我您是否如我所述在控制器中添加了一个额外的参数?