Welcome Guest, Not a member yet? Register   Sign In
Viewing Data from a MultiDimensional Array
#1

This is my Model:

?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Specs_model extends CI_Model{

$data['phone'] = array (
        'Body'=> array(
          'Dimensions'=>'142 x 72.5 x 8.1 mm (5.59 x 2.85 x 0.32 in)',
          'Weight'=> '145 g (5.11 oz)',
          'Sim'=>'Micro-SIM'

        ),
        'Display'=> array(
          'Type'=>'Super AMOLED capacitive touchscreen, 16M colors',
          'Size'=>'  5.1 inches (~69.6% screen-to-body ratio)',
          'Resolution'=>'1080 x 1920 pixels (~432 ppi pixel density)',
          'Multitouch'=>'Yes',
          'Protection'=>'Corning Gorilla Glass 3'
          ),
    'Platform' => array (
          'OS'=>' Android OS, v4.4.2 (KitKat), upgradable to v6.0 (Marshmallow)',
          'Chipset'=>'Qualcomm MSM8974AC Snapdragon 801',
          'CPU'=>'Quad-core 2.5 GHz Krait 400',
          'GPU'=>'Adreno 330'
   
)
);

function getPhoneData(){

    return $this->result_array();
}

This is the controller

<?php
defined('BASEPATH') OR exit('No direct script access allowed');
 
class Specifications extends CI_Controller {
 

    function index() {
     // $data['phone'] = array('John Doe', 'Alex Ferguson', 'Jose Mourinho');
     
        $this->load->model('Specs_model');
        $data['phone'] = $this->Specs_model->read()
        $this->load->view('Specifications', $data);
    }
}
?>

I'm getting the following reply:
Severity: Parsing Error
Message: syntax error, unexpected T_VARIABLE
Filename: controllers/Specifications.php
Line Number: 12
Backtrace:

Could someone tell me what am I doing wrong

Thanks

Greg
Reply
#2

You are missing a semi-colon on the $data['phone'] line.
Reply
#3

(09-22-2016, 06:23 AM)PaulD Wrote: You are missing a semi-colon on the $data['phone'] line.

$data['phone'] = array (  

Would that give you an error message?
Reply
#4

(09-22-2016, 04:23 PM)greg_c Wrote:
(09-22-2016, 06:23 AM)PaulD Wrote: You are missing a semi-colon on the $data['phone'] line.

$data['phone'] = array (  

Would that give you an error message?

he's talking about this line...

$data['phone'] = $this->Specs_model->read()

is missing a semicolon at the end and should be like this...

$data['phone'] = $this->Specs_model->read();
Reply




Theme © iAndrew 2016 - Forum software by © MyBB