Welcome Guest, Not a member yet? Register   Sign In
3 errors
#1

[eluser]stuffradio[/eluser]
Do you have any idea what these errors mean?

Quote:[Sat Jul 12 16:31:04 2008] [error] [client xx.xx.xx.xx] PHP Strict Standards: Assigning the return value of new by reference is deprecated in /var/www/vhosts/xxxxxxxx/httpdocs/system/codeigniter/Common.php on line 123, referer: xxxxxxxx/index.php/picture/id/1

[Sat Jul 12 16:31:04 2008] [error] [client xx.xx.xx.xx] PHP Strict Standards: Assigning the return value of new by reference is deprecated in /var/www/vhosts/xxxxxxxx/httpdocs/system/codeigniter/Common.php on line 129, referer: xxxxxxxx/index.php/picture/id/1

[Sat Jul 12 16:31:04 2008] [error] [client xx.xx.xx.xx] PHP Fatal error: Call to undefined method stdClass::get() in /var/www/vhosts/xxxxxxxx/httpdocs/system/application/controllers/picture.php on line 59, referer: xxxxxxxx/index.php/picture/id/1

I edited out the domain name and my IP address
#2

[eluser]adamfairholm[/eluser]
For the first two errors, I believe it has something to do with your error reporting configuration (in the root level index.php file). I'm not very familiar with the error but this thread may be of help.

For the last one - it just means that you're calling a method that you haven't defined. So maybe that function is in a model or controller or helper that you haven't loaded. I'd just check to make sure that somewhere you've defined that method somewhere and have it loaded.

Hope this helps a bit!
#3

[eluser]Seppo[/eluser]
The first two are php 5 warnings that are not big deal - It's just some CI code that has to be PHP 4 compatible, so it has stricts error on PHP 5 - You could lower your error_reporting level removing E_STRICT so you don't see them any more.

The third one is that you have an instance of stdClass (this is a PHP class with not method) and you are trying to call get method - probably you are mixing a database row with the database class - copy the lines arround line 59 in your picture controller if you can't fix it
#4

[eluser]stuffradio[/eluser]
Ok, yes I got the E_Strict error fixed... I had put that there before because I was getting a blank page and read somewhere on here that that would make it not become blank.

This is lines 56-59
Code:
$this->comments->photo_id = $this->input->post('photo_id', true);
    $theUsername = $this->comments->getOwner();
    $this->users->username = $theUsername->username;
    $getUser = $this->users->get();
#5

[eluser]Seppo[/eluser]
Can you put a bit more of code? There you are not setting "users" attribute... is that a model? If that so, aren't you overwritting it in someplace?
#6

[eluser]stuffradio[/eluser]
Here is the get function in users.

Code:
function get()
{

  if ($this->id)
  {
    $this->db->where('id', $this->id);
  }
  if ($this->username)
  {
    $this->db->where('username', $this->username);
  }
  if ($this->firstName)
  {
    $this->db->where('firstName', $this->firstName);
  }
  if ($this->lastName)
  {
    $this->db->where('lastName', $this->lastName);
  }
  if ($this->email)
  {
    $this->db->where('email', $this->email);
  }
   $query = $this->db->get('project_users');
   return $query->row();
}
#7

[eluser]Michael Wales[/eluser]
Did you load the users model?
#8

[eluser]Seppo[/eluser]
in $this->users you are having a stdClass object... in some point you are setting $this->users as an object that is not a model or stuff... can you put the complete code?
#9

[eluser]stuffradio[/eluser]
Seppo Wrote:in $this->users you are having a stdClass object… in some point you are setting $this->users as an object that is not a model or stuff… can you put the complete code?
Complete code of the users model?

This is the getOwner function. I'm doing it this way because I'm not sure of any other better way to do it.

Code:
function getOwner()
  {
    if ($this->photo_id)
    {
      $poster = $this->db->get_where('pb_photos', array('id' => $this->photo_id));
      $post_id = $poster->row();
      $check = $this->db->get_where('project_users', array('username' => $post_id->poster));
      
      return $check->row();
    } else {
     return false;
    }
  }

Michael Wales Wrote:Did you load the users model?
Yes.
#10

[eluser]mambe churchill nanje[/eluser]
why didnt you do it like a function
Code:
$user=$this->users->get($username);

then in the users model you do it like

Code:
function get($username,[optionals]){
   //here u query the database then return whatever
}

this way I think your picture controller wont know about the internal workings of your user model or in other words proper encapsulation




Theme © iAndrew 2016 - Forum software by © MyBB