PHP SIMPLE DOM PDO select
<p>I have in the database a list of links from which I want to take some data.</p>

<p>All the script is working, except the part when I'm taking the link from the DB and paste it in Simple DOM function.
"
    include ('utile/db.php');
    include_once('utile/simple_html_dom.php');</p>

<pre><code>$dbh = new PDO("mysql:host=$servername;dbname=$dbname;charset=utf8;", $username, $password);
$sth = $dbh-&gt;query("SELECT link FROM pilots where year = '2007' and Contry ='CZ' and zboruri &lt;&gt; '101' limit 3 ");

foreach ($sth as $url) {
     functie ($url['link']);
}

function functie($lin){
     $linkul=file_get_html("$lin");

// pages number
     $paging = $linkul-&gt;find('div[class*=paging]',0);
     echo $paging;
     $numar=-4;
     foreach($paging-&gt;find('a') as $element=&gt;$item){$numar++;}
     echo $numar;
}
</code></pre>

<p>"
I receive the following error:</p>

<pre><code>Fatal error: Call to a member function find() on null in C:\xampp\htdocs\para\teste.php on line 269
</code></pre>

<p>If I change the link manually it will work.</p>

<p>I think it is something related how I extract the link from DB and insert it the function.</p>

<p>Thank you </p>