I have a try block in which some exceptions will be definitely thrown but I don't want to stop the execution of the try block if this happens.
This is the code:
try {
$queryStr = "SELECT * FROM `$current_table` WHERE ...";
$query = $db->prepare($queryStr);
$query->execute();
while($row = $query->fetch()) {
}
} catch(PDOException $e) {
//echo $e->getMessage();
}
This try/catch block is inside a for loop, so $current_table
will be changing continously. Now this current table can take 4 values april-june-2014
, july-september-2014
, october-december-2014
and jan-march-2015
. These table names are stored in an array.
Now when it will query the first table and if it is found, then it's well and good but if it is not found then I want to check the other tables and see if those exists. If any of the table is not found, it will throw an exception and then it won't check the other tables.
Is there a way to do that?