mysql_error()
expects a "Link resource" and no "result resource". Te correct way would be something like:
$username="*****.com";
$password="*********";
$database="*********";
$connection = mysql_connect('127.0.0.1', $username, $password) or die('Could not connect'.mysql_error());
mysql_select_db($database, $connection) or die( "Cannot select db.");
$err = mysql_query("INSERT INTO tridy (id,NazevTridy,url) VALUES (
'$i',
'$tridy->find('div[class=rozvrhseznam]', 0)->find('a[href]', $i)->outertext',
'$tridy->find('div[class=rozvrhseznam]', 0)->find('a[href]', $i)->href')", $connection);
mysql_error($connection); // line 97
Mind the use of $connection
. Wile $connection could be dropped everywhere as in
mysql_error();
Which uses the last opened connection or opens a new one by default. While depending on the default connection is bad. You might also want to look into mysqli or PDO as alternative ways to talk to MySQL.