title: Inline Ternary Operator Not Working
body: <p>For some reason my ternary operator assignment isn't work for the second part of my array. Anyone see what I'm doing wrong? Its supposed to just see if there is a value for the permalink field and if there isn't then insert the <code>link_url</code> into the array.</p>
  
  <pre><code>function getSiteMap()
  {
      $this-&gt;db-&gt;select('site_menu_structures_links.id, site_menu_structures_links.link_name');
      $this-&gt;db-&gt;from('site_menu_structures_links');
      $this-&gt;db-&gt;where('site_menu_structures_links.status_id', 1); 
      $this-&gt;db-&gt;where('site_menu_structures_links.is_category', 'Yes'); 
      $this-&gt;db-&gt;order_by('site_menu_structures_links.sort_order'); 
      $catQuery = $this-&gt;db-&gt;get();
  
      if ($catQuery-&gt;num_rows())
      {
          foreach ($catQuery-&gt;result() as $cats)
          {
              // Set the Main Category into the array
              $testArray[$cats-&gt;id] = array(
                  'id'   =&gt; $cats-&gt;id,
                  'name' =&gt;$cats-&gt;link_name
              );
  
              $this-&gt;db-&gt;select('site_content_pages.permalink, site_menu_structures_links_children.id, site_menu_structures_links_children.link_url, site_menu_structures_links_children.link_name');
              $this-&gt;db-&gt;from('site_menu_structures_links_children');
              $this-&gt;db-&gt;join('site_content_pages', 'site_content_pages.id = site_menu_structures_links_children.site_content_pages_id');
              $this-&gt;db-&gt;where('site_menu_structures_links_id', $cats-&gt;id); 
              $this-&gt;db-&gt;where('site_menu_structures_links_children.status_id', 1);  
              $this-&gt;db-&gt;order_by('site_menu_structures_links_children.sort_order'); 
              $childrenQuery = $this-&gt;db-&gt;get();
  
  
  
              if ($childrenQuery-&gt;num_rows())
              {
                  foreach ($childrenQuery-&gt;result() as $child)
                  {
                      $testArray[$cats-&gt;id]['children'][$child-&gt;id] = array(
                          'linke_url' =&gt; (empty($child-&gt;permalink)) ? $child-&gt;link_url : $child-&gt;permalink,
                          'link_name' =&gt; $child-&gt;link_name,
                      );
                  }
              }
          }
      }
  
      return $testArray;
  }
  </code></pre>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Also not that there should be 3 items inside the Social Array and its not saying there is. I'm wondering if it has something to do with that join. Here's my output:</p>
  
  <pre><code>Array
  (
  [2] =&gt; Array
      (
          [id] =&gt; 2
          [name] =&gt; Roster
          [children] =&gt; Array
              (
                  [1] =&gt; Array
                      (
                          [linke_url] =&gt; 
                          [link_name] =&gt; Superstars
                      )
  
                  [2] =&gt; Array
                      (
                          [linke_url] =&gt; 
                          [link_name] =&gt; Champions and Contenders
                      )
  
                  [3] =&gt; Array
                      (
                          [linke_url] =&gt; 
                          [link_name] =&gt; Title History
                      )
  
              )
  
      )
  
  [3] =&gt; Array
      (
          [id] =&gt; 3
          [name] =&gt; Events
          [children] =&gt; Array
              (
                  [4] =&gt; Array
                      (
                          [linke_url] =&gt; 
                          [link_name] =&gt; Preview Next Event
                      )
  
                  [5] =&gt; Array
                      (
                          [linke_url] =&gt; 
                          [link_name] =&gt; Latest Event Results
                      )
  
                  [6] =&gt; Array
                      (
                          [linke_url] =&gt; 
                          [link_name] =&gt; Event Archives
                      )
  
                  [7] =&gt; Array
                      (
                          [linke_url] =&gt; 
                          [link_name] =&gt; Schedule An Event
                      )
  
              )
  
      )
  
  [4] =&gt; Array
      (
          [id] =&gt; 4
          [name] =&gt; Media
          [children] =&gt; Array
              (
                  [8] =&gt; Array
                      (
                          [linke_url] =&gt; 
                          [link_name] =&gt; Photo Gallery
                      )
  
              )
  
      )
  
  [5] =&gt; Array
      (
          [id] =&gt; 5
          [name] =&gt; Social
      )
  
   )
  </code></pre>