I am parsing table data via this code
$table = $myurl->find('table', 3);
$rowData = array();
foreach($table->find('tr') as $row)
{
$flight = array();
foreach($row->find('td') as $cell)
{
$flight[] = $cell->plaintext;
}
$rowData[] = $flight;
}
$rowcount= count($rowData);
$a = ($rowData[2][2]);
$b = ($rowData[2][1]);
It works well when table exists. but when no table exist it shows error.
This error
Call to a member function find() on null in C:\ .............abc.php on line 3
on following code.
foreach($table->find('tr' as $row))
I want to hide error. In case of no table or no row it should give "N/A" to the variables declared in the end of the code.