I have a code below that creates a multi qry
$sql_multi = ""; for ($branch_index = 0; $branch_index < count($branch_ids); $branch_index++) {