I have SQL query inside a for loop and I want to echo something of success of these query only once. Here is part of my code
<?php
for($i=0;$i<sizeof($assigned_project_id);$i++){
$sql2="SELECT * FROM assign_task INNER JOIN branch ON assign_task.branch_ID=branch.branch_ID WHERE project_ID=".$assigned_project_id[$i]." AND USER_ID=1";
$query2=mysqli_query($con,$sql2);
if(mysqli_num_rows($query2)>0){
echo" You have Assigned following Reports";
}
while($row2=mysqli_fetch_assoc($query2)){
echo $row2['branch_ID']." ".$row2['branch_name']."<br/>";
}
}
?>
I want to display the "You have Assigned following Reports" only once. Please help me.