title: Call to a member function find() on a non-object when inserting data using PHP mySQL simpleHTMLDOM
body: <p>I have a script that parses certain elements from a webpage and stores them in a mysql db. Everything works fine until I try to split an element and store the resulting data into the db. Any ideas what might be wrong? 
  Here's the page I'm parsing: <a href="http://www.ratemyprofessors.com/SelectTeacher.jsp?sid=953" rel="nofollow">http://www.ratemyprofessors.com/SelectTeacher.jsp?sid=953</a></p>
  
  <p>Here's my code:</p>
  
  <pre><code>&lt;?php
  include('simple_html_dom.php'); 
  
  //connect to db (code emitted)
  
  prof_List("http://www.ratemyprofessors.com/SelectTeacher.jsp?sid=953");
  
  function prof_name($url)
  {
      // collect data
      echo $url;
      $data = new simple_html_dom();  
      $data-&gt;load_file($url);
      $profName = $data-&gt;find("//*[@id=profName]", 0);
      $profName = strip_tags($profName);
      echo "Full Name: " . $profName = trim($profName);
      list($first, $last) = explode("&amp;nbsp;", $profName);
      echo "fname: " .  $first;
      echo "lname: " . $last;
  
      //call mysql function
      insert_row($profName, $first, $last);
  
  }
  
  
  function insert_row($profName, $first, $last)
  {
      $sql1="INSERT INTO PROFESSOR(name, firstname, lastname) VALUES('$profName','$first', '$last')";
      $sql1=strip_tags($sql1);
      echo $sql1;
      mysql_query($sql1) or die(mysql_error());  
      echo "Data Inserted!"; 
  }
  
  
  function prof_List($mainURL)
  {
  
      $list = new simple_html_dom();  
      $list-&gt;load_file($mainURL);
      $profLinks = $list-&gt;find("//*[@class=profName]/a");
      foreach($profLinks as $profLink)
      {
          $profU=$profLink-&gt;href;
          echo $profURL = "http://www.ratemyprofessors.com/" . $profU;
          prof_name($profURL);
      }
  
  }
  
  ?&gt;
  </code></pre>
  
  <p>Here's my output: </p>
  
  <pre><code>Connected to MySQL
  Connected to Databasehttp://www.ratemyprofessors.com/SelectTeacher.jsp?the_dept=All&amp;sid=953&amp;orderby=TLName&amp;toggel=truehttp://www.ratemyprofessors.com/SelectTeacher.jsp?the_dept=All&amp;sid=953&amp;orderby=TLName&amp;toggel=trueFull Name: fname: lname: INSERT INTO PROFESSOR1(name, firstname, lastname) VALUES('','', '')Data Inserted!http://www.ratemyprofessors.com/ShowRatings.jsp?tid=861228http://www.ratemyprofessors.com/ShowRatings.jsp?tid=861228
  Fatal error: Call to a member function find() on a non-object in /Users/user1/Sites/simple_html_dom.php on line 879
  </code></pre>