嗨, friend 们,如果我用 codeigniter 运行 php,我会收到以下错误:
A Database Error Occurred Error Number: 2014 Commands out of sync; you can't run this command now CALL get_sub_menu(3) Filename: C:\xampp\htdocs\ci\system\database\DB_driver.php Line Number: 330
Controller :
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class Learnersway extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->load->model('home');
}
function index()
{
$data['main_menu'] = $this->home->select_main_menu();
$data2['sub_menu'] = $this->home->select_sub_menu();
$this->load->helper('url');
$this->load->helper('html');
$this->load->view('home',$data,$data2);
}
}
?>
注意:
- 如果我同时运行数组 $data 和 $data2。我遇到了以上错误。
- 但我可以一次运行一个。
请告诉我如何同时运行数组 $data 和 $data2。
最佳答案
就用
$data['main_menu'] = $this->home->select_main_menu();
$data['sub_menu'] = $this->home->select_sub_menu();
....
$this->load->view('home',$data);
你可以通过以下方式让他们看到
print_r($main_menu);
print_r($sub_menu);
关于php - 如何同时运行两个数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20717464/