• 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
retrieving and showing data

#8
(07-12-2016, 09:18 AM)rtenny Wrote:
(07-12-2016, 07:34 AM)davy_yg Wrote: Hello,

I am trying to show data in here but have not been successful yet.


controllers/cpages.php

PHP Code:
public function pcategories() { 
    
        
$this->Mpages->retrieve_parentctg();

        
$data['ctgparent_name'] = $this->Mpages->retrieve_parentctg();
        
$data['ctgparent_description'] = $this->Mpages->retrieve_parentctg();
        
        
$this->load->view('pcategories'$data); 
        
    } 



views/pcategories.php


PHP Code:
<div class="widget-box">
                        <
div class="widget-title"><h5>Parent Categories</h5></div>
                        <
div class="widget-content">
                        
                        <
table border="0" style="width: 100%; height: 90px;">
                            <
tr>
                                <
td>PARENT NAME</td>
                                <
td>DESCRIPTION</td>
                                <
td>EDIT</td>
                                <
td>DELETE</td>    
                            </
td>
                            <
tr>
                                <
td>Mens</td>
                                <
td><?php echo $ctgparent_name?></td>
                                <td><button type="button" class="edit" onclick="location.href='<?php echo site_url('cpages/editparentctg'); ?>';">EDIT</button></td>
                                <td><button type="button" class="delete" href="adminform.php">DELETE</button></td>    
                            </td>    
                            <tr>
                                <td>Womens</td>
                                <td><?php echo $ctgparent_description?></td>
                                <td><button type="button" class="edit" onclick="location.href='<?php echo site_url('cpages/addparentctg'); ?>';">EDIT</button></td>
                                <td><button type="button" class="delete" href="adminform.php">DELETE</button></td>    
                            </td>    
                        </table>            
                        </div>
                    </div> 

The Result:

A PHP Error was encountered
Severity: Notice
Message: Array to string conversion
Filename: views/pcategories.php
Line Number: 54
Backtrace:
File: C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\CompanyGiondaCI\application\views\pcategories.php
Line: 54
Function: _error_handler
File: C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\CompanyGiondaCI\application\controllers\Cpages.php
Line: 46
Function: view
File: C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\CompanyGiondaCI\index.php
Line: 315
Function: require_once
Array

Womens
A PHP Error was encountered
Severity: Notice
Message: Array to string conversion
Filename: views/pcategories.php
Line Number: 60
Backtrace:
File: C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\CompanyGiondaCI\application\views\pcategories.php
Line: 60
Function: _error_handler
File: C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\CompanyGiondaCI\application\controllers\Cpages.php
Line: 46
Function: view
File: C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\CompanyGiondaCI\index.php
Line: 315
Function: require_once


SQL DATABASE - TABLE: menu_parent


ctgparent_name                    ctgp_no                  ctgparent_description
[Image: dot.gif]
Men                                        0                             Description


How to fix the error so that I can see the result?

I think your function $this->Mpages->retrieve_parentctg(); is return an array rather then a plain string.


How to make it works?


models/Mpages.php

PHP Code:
public function retrieve_parentctg()
    {
        
        $query 
$this->db->get('menu_parent');
        return $query->result();        
        
    

" If I looks more intelligence please increase my reputation."
Reply


Messages In This Thread
retrieving and showing data - by davy_yg - 07-12-2016, 07:34 AM
RE: retrieving and showing data - by arma7x - 07-12-2016, 07:44 AM
RE: retrieving and showing data - by davy_yg - 07-12-2016, 07:53 AM
RE: retrieving and showing data - by arma7x - 07-12-2016, 08:09 AM
RE: retrieving and showing data - by mwhitney - 07-12-2016, 08:26 AM
RE: retrieving and showing data - by rtenny - 07-12-2016, 09:18 AM
RE: retrieving and showing data - by davy_yg - 07-12-2016, 09:30 PM
RE: retrieving and showing data - by rtenny - 07-13-2016, 09:19 AM
RE: retrieving and showing data - by InsiteFX - 07-12-2016, 07:10 PM
RE: retrieving and showing data - by InsiteFX - 07-13-2016, 07:42 AM
RE: retrieving and showing data - by InsiteFX - 07-13-2016, 10:14 AM
RE: retrieving and showing data - by davy_yg - 07-13-2016, 06:31 PM
RE: retrieving and showing data - by davy_yg - 07-13-2016, 06:36 PM
RE: retrieving and showing data - by InsiteFX - 07-14-2016, 03:08 AM
RE: retrieving and showing data - by arma7x - 07-14-2016, 03:46 AM
RE: retrieving and showing data - by Ivo Miranda - 07-14-2016, 04:13 AM
RE: retrieving and showing data - by davy_yg - 07-16-2016, 07:18 PM
RE: retrieving and showing data - by mwhitney - 07-18-2016, 01:56 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.