我在调用表时出现问题我遇到错误,如何调用表并加载或发送到视图?
这是代码:
void dateType::Num_DayPassed()
{
int sum;
int yy = 365;
if (month ==1)
{
cout<<"Number of days Passed in the Year: "<<sum<<endl;
day=31;
sum=day-yy;
}
........
continued until month 12..
这是错误消息:
遇到PHP错误
严重性:注意
消息:未定义的变量:userData2
文件名:views / dashboard.php
行号:179
回溯:
文件:C:\ xampp \ htdocs \ cobaan \ e-magang \ application \ views \ dashboard.php 行:179功能:_error_handler
文件: C:\ XAMPP \ htdocs中\ cobaan \电子马钢\应用\控制器\ Pages.php 行:32功能:视图
文件:C:\ xampp \ htdocs \ cobaan \ e-magang \ index.php行:315功能: require_once
答案 0 :(得分:0)
这应该是(错误)
$data['userData'] = $this->model_users->fetchUserData($this->session->userdata('user_id'));
$data2['userData2'] = $this->model_users->fetchUserData($this->session->userdata('user_id'));
}
$this->load->view($page, $data, $data2);
像这样(正确)
$data['userData'] = $this->model_users->fetchUserData($this->session->userdata('user_id'));
$data['userData2'] = $this->model_users->fetchUserData($this->session->userdata('user_id'));
}
$this->load->view($page, $data); # pass only one array with different array pointer
在视图中
如果foreach
foreach($userData as $item)
{
}
foreach($userData2 as $item)
{
}
如果print_r
print_r($userData);
print_r($userData2);