Jump to content

Recommended Posts

Hey People, Im stuck right now and I need some fresh eyes. Seems this functions someone made that I gotta fix is broken Im assuming maybe a missing bracket or one out of place.. but.. Im not seeing it, ive been staring at it for far to long tryin to fix it find the issue etc.. and its eluding me. Right now the error I am getting is "unexpected $end"

 

heres the function

 

function getlinkedinstoredContacts($user_id,$limit=10,$offset=1){
    $query = $this->db->get_where('cm_user_linkedin_contacts', array('user_id' => $user_id,'same_company'=>'Y'),$limit,$offset);
    if ($query->num_rows() > 0){
	$contacts = $query->result();

    //Loop throught the contact list
    foreach ($contacts as $key => $contact){
      $headline = $contact->headline;
      if (preg_match('/(at )| @ /', $headline)){$arr = preg_split('/(at )| @ /', $headline, 2);}
      elseif (preg_match('/,/', $headline)){$arr = preg_split('/,/', $headline, 2);}
      else{$arr[0] = $headline;$arr[1] = '';}
      $arr[0] = preg_replace('/^\s*/', '', $arr[0]);
      $arr[0] = preg_replace('/\s*$/', '', $arr[0]);
      $arr[1] = preg_replace('/^\s*/', '', $arr[1]);
      $arr[1] = preg_replace('/\s*$/', '', $arr[1]);
      $current_company_position = $arr[0];  // job_title
      $current_company_name=$arr[1];  //company
      //for testing 
      if ($counter > 21){unset($contacts[$key]);}
      else{
        $contact->job_title=$current_company_position;
        $contact->current_company=$current_company_name;
        if ($contact->picture_url == ''){
          $contact->picture_url = $this->config->item('base_url') . "static/images/avatar-large.jpg')";
          $contacts[$key]=$contact;
          $counter++;
	}
      }
      return $contacts;
    }
    return null;
  }

 

Just one of them days I suppose. Still bangin my head against the keys on this one. I just don't get it.. And Ill bet above anything else that my issue with this is something so small, so stupid.. and I'm just not seeing it.

When making a call to it, yes..

 

But Ive isolated the entire function in an otherwise empty php file. just to see if it would give me an error, and what error that might be, and its unexpected $end the only thing I can think of is a broken bracket, parenthesis or something to the effect there of, however I am just not seeing it for the life of me, and all in all it seems like the function from inspecting visually its all in place.

:'( Im just convinced everything on this project I am working on just hates me. Its one ghost bug after the other after the other. None of its my code originally, and working with it has been a nightmare.. unfortunatly theres not much I can do at the current time to improve on it much to make it better, im stuck making due with what I have to work with.

HAH wow, thats what I said, something entierly stupid somewhere that I am missing.. son of a bish, you know how many hours i spent lookin at that thing going over and over it and I still managed to miss that.. damn man.. thank you though for pointing it out..

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.