我是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;"> 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> </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>
我收到以下错误:
1)Severity:warning MISSING ARGUMENT 9 FOR searchresultss::login
2)severity:notice Undefined variable
无法找到错误的位置请帮帮我
答案 0 :(得分:0)
在控制器功能中添加一个参数
$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)
调用该函数时,您错过了控制器中的参数。如果您需要,请告诉我。