title: Trying to get property of non-object simple html dom in php
body: <p>I am trying to display every row of table with <a href="http://simplehtmldom.sourceforge.net/" rel="nofollow">SIMPLE HTML DOM</a>. Plus add at the end of row 2 links</p>
  
  <pre><code>&lt;?php
      include('simple_html_dom.php');
  
      //Connection
      $link = mysqli_connect("localhost", "root", "", "webapp");
      mysqli_set_charset($link, "utf8");
  
      //Checks connection
      if (mysqli_connect_errno($link)) { exit("Failed to connect to MySQL: " . mysqli_connect_error()); }
  
      //Selects content of DB
      $postContent = mysqli_query($link, "SELECT post_content FROM wp_posts WHERE ID=1");
  
      //Creates array from content
      $result = mysqli_fetch_array($postContent);
  
      //Loads content as first element of array
      $html = str_get_html($result[0]);
  
      foreach($html-&gt;find('tr') as $element) {
          $temphtml = str_get_html($element-&gt;innertext);
          $tempico = $temphtml-&gt;find('a', 0)-&gt;innertext; //line #42
          echo "&lt;tr&gt;" . $temphtml . "&lt;td&gt;&lt;a href=\"delete.php?ico=" . $tempico . "\"&gt;Delete&lt;/a&gt; // &lt;a href=\"change.php?ico=" . $tempico . "\"&gt;Change&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;";
  }
  ?&gt;
  </code></pre>
  
  <p><code>$tempico</code> is number which is later used as url parameter. On line #42 I am trying to get it from between first <code>&lt;a&gt;</code> tag in row.</p>
  
  <p>My problem is at line #42 where I get error <code>Notice: Trying to get property of non-object in C:\wamp\www\control.php on line 42</code></p>
  
  <p>Is there any way I can do this better or to not get this error?</p>
  
  <p>Here is html in database</p>
  
  <pre><code>&lt;table class="tg-table-orange"&gt;
  &lt;tbody id="SK"&gt;
  &lt;tr id="47 387 131"&gt;
      &lt;td&gt;&lt;a href="link" class="ico"&gt;47 387 131&lt;/a&gt;&lt;/td&gt;
      &lt;td class="47 387 131"&gt;BARDOSA&lt;/td&gt;
      &lt;td&gt;s.r.o.&lt;/td&gt;
      &lt;td&gt;06.09.2013&lt;/td&gt;
      &lt;td class="47 387 131"&gt;&lt;a class="button1" href="link"&gt;Zarezervuj&lt;/a&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>Thank you in advance</p>