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 7837833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T14:51:57+00:00 2026-06-02T14:51:57+00:00

I have two tables like this: CREATE TABLE `tblFacilityHrs` ( `id` int(11) NOT NULL

  • 0

I have two tables like this:

CREATE TABLE `tblFacilityHrs` (
          `id` int(11) NOT NULL AUTO_INCREMENT,
          `uid` varchar(45) DEFAULT NULL,
          `title` varchar(100) DEFAULT NULL,
          `description` text,
          PRIMARY KEY (`id`),
          KEY `key_uid` (`uid`)
        ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1$$

        CREATE TABLE `tblFacilityHrsDateTimes` (
          `id` int(11) NOT NULL AUTO_INCREMENT,
          `owner_uid` varchar(45) DEFAULT NULL,
          `startDate` date DEFAULT NULL,
          `endDate` date DEFAULT NULL,
          `startTime` time DEFAULT NULL,
          `endTime` time DEFAULT NULL,
          `days` int(2),
          `recurrence` int(1) DEFAULT NULL,
          PRIMARY KEY (`id`),
          KEY `fk_fh_owneruid` (`owner_uid`),
          CONSTRAINT `fk_fh_owneruid` FOREIGN KEY (`owner_uid`) REFERENCES `tblFacilityHrs` (`uid`) ON DELETE CASCADE ON UPDATE CASCADE
        ) ENGINE=InnoDB AUTO_INCREMENT=52 DEFAULT CHARSET=latin1$$

id uid title description location
8ada0ceabd40d509c3fb38f2822a97de11bc6628 Swim Lessons Parent and Child
Classes CRC 2 543a6ed0005ff6a0a7fc99cc2f9715d86804ecb0 Swim Lessons
Level 1, Session 1 3 7d219b64be6dc706135bdad3e7c2f0d56cb7f353 Swim
Lessons Level 2 4 f7c91e2f1daa9c696c22f5aa5736c167d1ba9f94 Swim
Lessons Level 3 5 262f06fb75645248162aa983f610ec7959a2011b Swim
Lessons Level 4 6 51f9f552ffc5fa4bc8b4e7f914fb22b3b0920c2e Bike 275
Participate in this program and take 4 Fitness Cycling classes and get
a FREEWaterbottle! Participants can only register 1 time. This is a
FREE program! Sign up in the Multipurpose Room. 7
0cca3515ec8ee990c863e474fee634ae94d382c2 Passport to Fitness Take
Norse Fitness Classes, Get your Passport Stamped and win aFree
T-shirt! Take 8 Fitness classes between April 10 and May 1 and get a
Free T-shirt.

id owner_uid startDate endDate startTime endTime days recurrance
8ada0ceabd40d509c3fb38f2822a97de11bc6628 4/13/2012 4/13/2012 0:00:00
NULL NULL None 2 543a6ed0005ff6a0a7fc99cc2f9715d86804ecb0 NULL NULL
12:30:00 2:00:00 2 3 7d219b64be6dc706135bdad3e7c2f0d56cb7f353 NULL
NULL NULL NULL NULL NULL 4 f7c91e2f1daa9c696c22f5aa5736c167d1ba9f94
NULL NULL NULL NULL NULL NULL 5
262f06fb75645248162aa983f610ec7959a2011b NULL NULL NULL NULL NULL NULL
6 51f9f552ffc5fa4bc8b4e7f914fb22b3b0920c2e NULL NULL NULL NULL NULL
NULL 7 0cca3515ec8ee990c863e474fee634ae94d382c2 NULL NULL NULL NULL
NULL NULL

In my controllers folder I have a file named main.php with the following code:

...
function fitnessSchedule()
    {
        $this->config->set_item('url_suffix', '');
        $crud = new grocery_CRUD();

        $crud->set_model('schedule_model');
        $crud->set_table('tblFitnessClasses');
        $crud->join_table('tblFitnessClasses','tblFitnessClassDateTimes');
        $crud->columns('title','description','location','startDate','endDate','startTime', 'endTime', 'days', 'recurrance');
        $crud->display_as('title','Event')
             ->display_as('description','Description')
             ->display_as('location','Location')
             ->display_as('startDate','Start Date')
             ->display_as('endDate','End Date')
             ->display_as('startTime','Start Time')
             ->display_as('endTime','End Time');
        $crud->required_fields('title','location');
        $crud->set_subject('Event');              

        $output = $crud->render();
        $this->_example_output($output);    
    }

    function _example_output($output = null)    
    {
        $this->load->view('main_view', $output);    
    }
...

In my models folder I have this:

<?php
class schedule_model extends grocery_CRUD_Model
{
        function join_table($table1, $table2)
        {
         if($this->$table1 === null)
          return false;

         $select = "{$this->$table1}.*";
         $select .=",$table2.startDate, $table2.endDate, $table2.startTime, $table2.endTime, $table2.days, $table2.recurrence";

         if(!empty($this->relation))
          foreach($this->relation as $relation)
          {
           list($field_name , $related_table , $related_field_title) = $relation;
           $unique_join_name = $this->_unique_join_name($field_name);
           $unique_field_name = $this->_unique_field_name($field_name);

        if(strstr($related_field_title,'{'))
                $select .= ", CONCAT('".str_replace(array('{','}'),array("',COALESCE({$unique_join_name}.",", ''),'"),str_replace("'","\\'",$related_field_title))."') as $unique_field_name";
           else   
                $select .= ", $unique_join_name.$related_field_title as $unique_field_name";

           if($this->field_exists($related_field_title))
                $select .= ", {$this->$table1}.$related_field_title as '{$this->$table1}.$related_field_title'";
          }

         $this->db->select($select, false);


         $this->db->join('uid', '$table2.owner_uid = $table1.uid');

         $results = $this->db->get($this->$table1)->result();

         return $results;
        }

        /* function join_table($table1, $table2)
        {
                $this->db->select('$table1.*');
                $this->db->join('$table2','$table1.uid = $table2.owner_uid','left');
                $this->db->get('$table1');
         }*/
}
?>

I’m getting this error:

Fatal error: Call to undefined method grocery_CRUD::join_table() in
C:\xampp\htdocs\codeigniter\application\controllers\main.php on line
234

I’m basically trying to concatenate tblFacilityHrs with tblFacilityHrsDateTimes by way of UID (uid to owner_uid). I want to display both tables at once so that when a user edits the table not only do they edit the event’s name/location they also edit its time/date etc.

Reference: http://www.grocerycrud.com/documentation/options_functions/set_model

  • 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-06-02T14:52:01+00:00Added an answer on June 2, 2026 at 2:52 pm

    In this forum thread, web-johnny states that this functionality is not yet possible.

    This is the 1-1 relation that grocery CRUD doesn’t have this
    functionality yet. It depends of how much time I will have in the
    future to do that and/or if I have any good donations till then.

    This functionality is a big deal and also really complicated to do it,
    but I think it will save lot of time for many users when it will come
    up.

    Perhaps if you provide what web-johnny deems to be a good donation he might implement it.

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

Sidebar

Related Questions

So I have two tables structured like so: CREATE TABLE #nodes(node int NOT NULL);
I have two tables like these: CREATE TABLE people ( id INT NOT NULL,
I have two tables like this: CREATE TABLE table1_lang ( id serial NOT NULL,
i have two tables: CREATE TABLE public.auctions ( id VARCHAR(255) NOT NULL, auction_value_key VARCHAR(255)
I have two tables which looks something like this Table Queue int ID; string
So here's the setup. I have two tables: CREATE TABLE dbo.TmpFeesToRules1(Name varchar, LookupId int)
I have two tables: CREATE TABLE Table1 ( ID VARCHAR(15), Value INT ); INSERT
i have two tables: 1. CREATE TABLE [dbo].[HotelSourceMap]( [hotelsourcemapid] [bigint] IDENTITY(1,1) NOT NULL, [dspartnerid]
I have two already-existing tables which look (in part) roughly like this: CREATE TABLE
I have two tables like this create table A_DUMMY ( TRADE_ID VARCHAR2(16) TRADE_DATA VARCHAR2(500)

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.