Welcome Guest, Not a member yet? Register   Sign In
uploading picture
#18

(This post was last modified: 08-30-2016, 05:13 AM by wolfgang1983.)

(08-30-2016, 01:45 AM)davy_yg Wrote: How to fix this error message?

Another error message appears:

A PHP Error was encountered
Severity: Notice
Message: Undefined variable: images

Filename: views/addslideshows.php
Line Number: 103
Backtrace:
File: C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\companygiondaci\application\views\addslideshows.php
Line: 103

Function: _error_handler
File: C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\companygiondaci\application\controllers\Cuploadfile.php
Line: 36
Function: view
File: C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\companygiondaci\index.php
Line: 315

Function: require_once
A PHP Error was encountered
Severity: Warning
Message: Invalid argument supplied for foreach()


Filename: views/addslideshows.php
Line Number: 103
Backtrace:
File: C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\companygiondaci\application\views\addslideshows.php
Line: 103
Function: _error_handler

File: C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\companygiondaci\application\controllers\Cuploadfile.php
Line: 36
Function: view
File: C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\companygiondaci\index.php
Line: 315
Function: require_once 

-------------------------------------------------

views/addslideshows.php
 
PHP Code:
   <?php foreach ($images as $images_item): ?>


controllers/Cpages.php


PHP Code:
public function addslideshows() {

            
        $data
['images'] = $this->Mpages->call_slideshow();
        
        $this
->load->view('addslideshows'$data); 
    
    



Try on controller


PHP Code:
<?php

class Cuploadfile extends CI_Controller {

public function 
__construct() {
 
  parent::__construct();
 
  $this->load->model('mpages');
}

public function 
index() {

}

public function 
addslideshows() {

    $data['images'] = array();

    $results[] = $this->mpages->call_slideshow();

    var_dump($results); // Check if any results are actually there.

    $data['images'] = $results;

    $this->load->view('addslideshows'$data);

}




You should var_dump your model function in your return of model you may need to use return $query->result_array()


PHP Code:
<?php if ($images) {?>

    <?php foreach ($images as $images_item) { ?>
          <?php echo $images_item['name'];?>
    <?php ?>

<?php ?>
There's only one rule - please don't tell anyone to go and read the manual.  Sometimes the manual just SUCKS!
Reply


Messages In This Thread
uploading picture - by davy_yg - 08-07-2016, 10:29 PM
RE: uploading picture - by davy_yg - 08-18-2016, 08:31 PM
RE: uploading picture - by wolfgang1983 - 08-22-2016, 07:23 PM
RE: uploading picture - by Fallebdi - 08-22-2016, 03:14 AM
RE: uploading picture - by davy_yg - 08-28-2016, 07:30 PM
RE: uploading picture - by ciadmin - 08-28-2016, 10:00 PM
RE: uploading picture - by davy_yg - 08-29-2016, 12:54 AM
RE: uploading picture - by salain - 08-29-2016, 02:50 AM
RE: uploading picture - by InsiteFX - 08-29-2016, 05:21 AM
RE: uploading picture - by davy_yg - 08-30-2016, 12:02 AM
RE: uploading picture - by wolfgang1983 - 08-30-2016, 12:30 AM
RE: uploading picture - by davy_yg - 08-30-2016, 12:38 AM
RE: uploading picture - by wolfgang1983 - 08-30-2016, 12:41 AM
RE: uploading picture - by davy_yg - 08-30-2016, 01:04 AM
RE: uploading picture - by salain - 08-30-2016, 01:09 AM
RE: uploading picture - by davy_yg - 08-30-2016, 01:45 AM
RE: uploading picture - by wolfgang1983 - 08-30-2016, 05:09 AM
RE: uploading picture - by salain - 08-30-2016, 02:09 AM
RE: uploading picture - by davy_yg - 09-12-2016, 11:01 PM



Theme © iAndrew 2016 - Forum software by © MyBB