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
Codeigniter 我的申请有问题foreach提供的无效论点_Codeigniter - Fatal编程技术网

Codeigniter 我的申请有问题foreach提供的无效论点

Codeigniter 我的申请有问题foreach提供的无效论点,codeigniter,Codeigniter,控制器: <?php defined('BASEPATH') or exit('No direct script access allowed'); class Soal extends CI_Controller { function __construct() { parent::__construct(); $this->load->database(); } public function index()

控制器:

<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Soal extends CI_Controller
{
    function __construct()
    {
        parent::__construct();
        $this->load->database();
    }
    public function index()
    {
        $data['judul'] = 'Halaman Ujian';
        $this->load->view('templates/header_cover', $data);
        $this->load->view('soal/index');
        $this->load->view('templates/footer');
    }
    public function tampil_soal()
    {
        $this->load->model('soalmodel');
        $this->data['tanya'] = $this->soalmodel->getPertanyaan();
        $this->load->view('soal', $this->data);
    }
}
}
?>

显示控制器代码以进行检查我必须显示代码两次,以防代码过多。1。2.函数{parent::{u-construct;$this->load->database;}公共函数tampil\u-soal{$this->load->model'soalmodel';$this->data['tanya']=$this->soalmodel->getpertanyan;$this->load->view'soal',$this->data;}没有人能读到。将代码放入问题本身,并正确设置格式。阅读:。您的问题应包括模型/视图/控制器的相关部分。请注意,您得到的错误很可能是由于查询失败或没有行!
Filename: soal/index.php

Line Number: 23

Backtrace:

File: C:\xampp\htdocs\TA\application\views\soal\index.php
Line: 23
Function: _error_handler

File: C:\xampp\htdocs\TA\application\controllers\Soal.php
Line: 11
Function: view

File: C:\xampp\htdocs\TA\index.php
Line: 315
Function: require_once

A PHP Error was encountered
Severity: Warning

Message: Invalid argument supplied for foreach()

Filename: soal/index.php

Line Number: 23

Backtrace:

File: C:\xampp\htdocs\TA\application\views\soal\index.php
Line: 23
Function: _error_handler

File: C:\xampp\htdocs\TA\application\controllers\Soal.php
Line: 11
Function: view

File: C:\xampp\htdocs\TA\index.php
Line: 315
Function: require_once
    <?php $ans_araay = array($row->pilihan1, $row->pilihan2, $row->pilihan3, $row->jawaban);
    shuffle($ans_araay); ?>

    <p>
        <?= $row->id_soal ?>.<?= $row->pertanyaan ?>
    </p>

    <input type="radio" name="idsoal<?= $row->id_soal ?>" value="<?= $ans_araay[0] ?>"> <?= $ans_araay[0] ?><br>
    <input type="radio" name="idsoal<?= $row->id_soal ?>" value="<?= $ans_araay[1] ?>"> <?= $ans_araay[1] ?><br>
    <input type="radio" name="idsoal<?= $row->id_soal ?>" value="<?= $ans_araay[2] ?>"> <?= $ans_araay[2] ?><br>
    <input type="radio" name="idsoal<?= $row->id_soal ?>" value="<?= $ans_araay[3] ?>"> <?= $ans_araay[3] ?><br>
<?php