Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7633949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:01:59+00:00 2026-05-31T07:01:59+00:00

This will probably be very easy to get a solution for, but I can’t

  • 0

This will probably be very easy to get a solution for, but I can’t get it to work and I’ve been trying some different methods I’ve found online ( read SO ). The strange is that my code worked perfectly when I had a different source for the images.

Anyway my error:

Message: Undefined index: url
Filename: models/imageloader.php
Line Number: 21

The code creating the array:

<?php
class imageLoader extends CI_Model {

    var $gallery_path;
    var $gallery_path_url;

    function __construct() {
        parent::__construct();
        $this->gallery_path = realpath(APPPATH . '../public_html/images');
        $this->gallery_path_url = base_url() . 'images/';
    }   

    function get_images() {
            //$this->session->userdata('email')
            $this->db->where('upload_email', $this->session->userdata('email'));
            $query = $this->db->get('uploaded_images');
            $images = array();
            if($query->num_rows > 0) {
                foreach($query->result_array() as $row) {
                    $images[] = array(
                        'url' => $this->gallery_path_url . $row['url'],
                        'thumb_url' => $this->gallery_path_url . 'thumbs/' . $row['url']
                    );
                }
                return $images;
            }
        }
}

And last the view for displaying some images:

<?php 
    $x=0;
    if(isset($images) && count($images)):
        foreach($images as $image): ?>
            <div class="thumb">
                <a href="<?php echo $image['url']; ?>"><img src="<?php echo $image['thumb_url']; ?>" /></a>
            </div>
            <?php $x++;
            /*if($x == 21)
                break;*/
        endforeach; else: ?>

My old code that sucks but work:
http://pastie.org/3566053

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T07:02:01+00:00Added an answer on May 31, 2026 at 7:02 am

    The line that’s throwing the error seems to be the one where you reference $row[‘url’]. If you don’t already have a url column in your uploaded_images table, adding one ought to fix your problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok so this i probably very easy but i can't seem to figure it
This is a very newbie question and i will probably get downvoted for it,
This will probably be obvious but I can't find the best way. I want
This is probably very easy, but it's Monday morning. I have two tables: Table1:
This is probably very easy, but I'm having a hard time figuring it out.
Im very new to Hibernate so this will probably a easy task for you
This is a very specific question which will probably earn me the tumbleweed badge,
This will probably be a bot of a waffly question but ill try my
It probably isn't even possible to do this, but I will ask anyway. Is
I'm sure this is very easy, and very simple, but I'm a complete AppleScript

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.