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

  • SEARCH
  • Home
  • 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 6376663
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:46:25+00:00 2026-05-25T01:46:25+00:00

I am calling a function twice from two different functions, But for one of

  • 0

I am calling a function twice from two different functions, But for one of the function it says “trying to get property of non-object”
first function is

$sql=$this->db->query("select * from gl_events where entry_id='$entry_id'");
if($sql->num_rows() > 0)
{
    $row3=$sql->row();
    $event_respond[] = 
        array(
            'entry_id'=>$row3->entry_id,
            'event_title'=>$row3->event_title,
            'location'=>$row3->event_loc_add_ln1,
            'location1'=>$row3->event_loc_add_ln2,
            'start'=>$row3->event_start_date,
            'start1'=>$row3->event_start_time,
            'created'=>$row3->user_id,
            'about'=>$row3->event_descr,
            'end'=>$row3->event_end_time,
            'end1' => $row3->event_end_time,
            'userid'=>$row3->user_id,
             //here the function goes to gl_get_att function and  
             //calls gl_getusername function,
            'attend'=>$this->gl_get_att($row3->entry_id),
             // here it calls gl_getusername function directly
            'username'=>$this->gl_getusername($row3->user_id)
       );
}

gl_get_att definition:

public function gl_get_att($entry_id)
{
    $query=$this->db->query("select * from gl_event_participants where event_id='$entry_id'");
    //echo "select * from gl_event_participants where event_id='$entry_id'";
    $row1=$query->row();
    foreach($query->result() as $row)
    {
        $data[]= array(
            'user_id'=>$row->user_id,
            'username'=>$this->gl_getusername($row->user_id)// here it calls get username function
        );
    }
    //print_r($data[1]);
    //print_r($data[0]);
    return $data;
}

gl_getusername definition:

public function  gl_getusername($user_id)
{
    $query=$this->db->query("select user_name from gl_user where user_id = '$user_id'");
    $row1=$query->row();
    //print_r($row1->user_name);
    return $row1->user_name; //This is line 396
}

Now for gl_get_att its returning the proper values but for the first function where i have called it directly its not working

error message: A PHP Error was encountered
Severity: Notice
Message: Trying to get property of non-object
Filename: events/gl_event_model.php
Line Number: 396

line 396 is marked above

This was working fine on saturday after the weekend its not working !!! strange

  • 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-25T01:46:26+00:00Added an answer on May 25, 2026 at 1:46 am

    You aren’t checking to see if $query is valid, or if $query->row() returns an object. This error would be generated if the passed in $entity_id is not found in the database.

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

Sidebar

Related Questions

I'm trying to return a value from (transport) to the calling function, but can't
I am calling a function in my controller from a button click .... I
Is there anyway to calling a function from another function .. little hard to
The calling function from php does not work... function Footer() { $this->Cell($this->PG_W, 5, 'All
long shot: is it possible to get the name of a calling function or
Does anyone know how to watch a variable in calling function. For example: C#:
I'm calling a function with call_user_func_array : call_user_func_array(array($this, 'myFunction'), array('param1', 'param2', 'param3')); Everything is
I'm calling a function and adding a listener for when the function returns some
Suppose you are calling a function, where there's clearly a need to break down
Is message passing taking place when calling a function with no input? i.e. with:

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.