I have Trouble in PHP and codeIgniter in web application

I have Trouble in PHP and codeIgniter in web application. Error this application on Invalid argument supplied for foreach(), error_handler and require_once
A PHP Error was encountered

Severity: Warning

Message: Invalid argument supplied for foreach()

Filename: controllers/Student1.php

Line Number: 117


File: C:wampwwwsmsapplicationcontrollersStudent1.php
Line: 117
Function: _error_handler

File: C:wampwwwsmsindex.php
Line: 292
Function: require_once

public function fetchStudentData($studentId = null)
if($studentId) {
$result = $this->model_student1->fetchStudentData($studentId);
else {
$studentData = $this->model_student1->fetchStudentData();
$result = array(‘data’ => array());

foreach ($studentData as $key => $value) {
$button = ‘<!– Single button –>
<div class=”btn-group”>
<button type=”button” class=”btn btn-default dropdown-toggle” data-toggle=”dropdown” aria-haspopup=”true” aria-expanded=”false”>
Action <span class=”caret”></span>
<ul class=”dropdown-menu”>
<li><a type=”button” data-toggle=”modal” data-target=”#updateStudentModal” onclick=”editStudent(‘.$value[‘student_id’].’)”> <i class=”glyphicon glyphicon-edit”></i> Edit</a></li>
<li><a type=”button” data-toggle=”modal” data-target=”#removeStudentModal” onclick=”removeStudent(‘.$value[‘student_id’].’)”> <i class=”glyphicon glyphicon-trash”></i> Remove</a></li>

$photo = ‘ <img src=”../’.$value[‘image’].'” alt=”Photo” class=”img-circle candidate-photo”/>’;

$result[‘data’][$key] = array(
$value[‘name’] . ‘ ‘ . $value[‘lname’],
} // /foreach
echo json_encode($result);

Read more here:: I have Trouble in PHP and codeIgniter in web application

Leave a Reply

Your email address will not be published. Required fields are marked *