Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] Showing Galleries_name
#1

(This post was last modified: 08-17-2016, 07:22 PM by davy_yg.)

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



views/editgalleries.php


PHP Code:
<table>
                    <
tr>
                    <
td><i>GALLERIES NAME: <?php echo $galleries_name?></i></td>
                    </tr>
                    <tr>
                    <td>
                        <br><br>ADD IMAGE<br>
                        <input type="text"></input> 
                        <br><br>
                    </td>
                    
                    <td>
                        <div style="margin-left: 50px; margin-top: 60px;">
                                            
                        <div class="form-group">
                        <div class="row">
                        <div class="col-md-12">
                        
                        <input type="file" name="filename" size="20" />
                        <span class="text-danger"><?php if (isset($error)) { echo $error; } ?></span>
                        </div>
                        </div>
                        </div>
            
                        
                        <div class="row">
                            <div class="col-md-12">
                                <input type="submit" class="edit" value="Upload Image" class="btn btn-primary"/>
                            </div>
                        </div>
                        </div>
                    </td>
                    </tr>
                    </table> 




controllers/Cpages.php


PHP Code:
public function editgalleries() { 
    
        
$id $this->uri->segment(3);
    
        
$data['galleries_name'] = $this->Mpages->edit_gallery($id);
    
        
$this->load->view('editgalleries'$data); 
        
    } 


models/Mpages.php


PHP Code:
    public function edit_gallery($id)
    {
        
$this->db->where('galleries_id'$id);
        
$query $this->db->get('galleries');
        return 
$query->result_array();
        
    } 
" If I looks more intelligence please increase my reputation."
Reply
#2

(This post was last modified: 08-17-2016, 12:30 AM by JayAdra.)

Can someone just ban him? Most of his issues aren't CI related and he doesn't seem interested in doing anything to solve his own problems.
Reply
#3

@JayAdra

+1
Reply
#4

(08-17-2016, 12:30 AM)JayAdra Wrote: Can someone just ban him? Most of his issues aren't CI related and he doesn't seem interested in doing anything to solve his own problems.


I've thought about this too, but he'd just create another account and continue posting this stuff. I've just resorted to linking him to the php.net site.
Codeigniter is simply one of the tools you need to learn to be a successful developer. Always add more tools to your coding arsenal!
Reply
#5

(This post was last modified: 08-17-2016, 03:19 PM by wolfgang1983.)

(08-16-2016, 09:47 PM)davy_yg Wrote: GALLERIES NAME:
A PHP Error was encountered
Severity: Notice
Message: Array to string conversion
Filename: views/editgalleries.php
Line Number: 46
Backtrace:
File: C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\CompanyGiondaCI\application\views\editgalleries.php
Line: 46
Function: _error_handler
File: C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\CompanyGiondaCI\application\controllers\Cpages.php
Line: 348
Function: view
File: C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\CompanyGiondaCI\index.php
Line: 315
Function: require_once



views/editgalleries.php


PHP Code:
<table>
                    <
tr>
                    <
td><i>GALLERIES NAME: <?php echo $galleries_name?></i></td>
                    </tr>
                    <tr>
                    <td>
                        <br><br>ADD IMAGE<br>
                        <input type="text"></input> 
                        <br><br>
                    </td>
                    
                    <td>
                        <div style="margin-left: 50px; margin-top: 60px;">
                                            
                        <div class="form-group">
                        <div class="row">
                        <div class="col-md-12">
                        
                        <input type="file" name="filename" size="20" />
                        <span class="text-danger"><?php if (isset($error)) { echo $error; } ?></span>
                        </div>
                        </div>
                        </div>
            
                        
                        <div class="row">
                            <div class="col-md-12">
                                <input type="submit" class="edit" value="Upload Image" class="btn btn-primary"/>
                            </div>
                        </div>
                        </div>
                    </td>
                    </tr>
                    </table> 




controllers/Cpages.php


PHP Code:
public function editgalleries() { 
    
        
$id $this->uri->segment(3);
    
        
$data['galleries_name'] = $this->Mpages->edit_gallery($id);
    
        
$this->load->view('editgalleries'$data); 
        
    } 


models/Mpages.php


PHP Code:
    public function edit_gallery($id)
    {
        
$this->db->where('galleries_id'$id);
        
$query $this->db->get('galleries');
        return 
$query->result_array();
        
    } 

You need to have it in foreach loop because the result is in an array

Code:
<?php foreach ($galleries_name as $gallery) {?>
<img src="<?php echo $gallery['image'];?>" >
<?php }?>


If you are building a online shop I would watch https://www.youtube.com/watch?v=am_di0HfnzI

Or

Use www.opencart.com it will save you asking a whole lot of questions
There's only one rule - please don't tell anyone to go and read the manual.  Sometimes the manual just SUCKS!
Reply
#6

Appologize all. I've found answer to these question. I'll marked it solved.
" If I looks more intelligence please increase my reputation."
Reply
#7

(08-17-2016, 07:21 PM)davy_yg Wrote: Appologize all.  I've found answer to these question.  I'll marked it solved.

Can you try to do some research before posting basic debug errors on this forum?
Codeigniter is simply one of the tools you need to learn to be a successful developer. Always add more tools to your coding arsenal!
Reply




Theme © iAndrew 2016 - Forum software by © MyBB