Brazil, United States, Mexico
Code: Select all
<?php require_once('config.php');
$query1="SELECT * FROM ticket";
$sql=mysql_query("SELECT * FROM passenger LIMIT 2 OFFSET 0 ");
while($array1=mysql_fetch_assoc($sql)){
$subscountry1=$array1['subs_country'];
$subscountry2= explode(",", $subscountry1);
for($i = 0; $i < count($subscountry2); $i++){
$subscountry[$i] = $subscountry2[$i];
$query_action1=mysql_query($query1);
$num1=mysql_num_rows($query_action1);
if(!empty($num1)){
while($array=mysql_fetch_assoc($query_action1)){
$id=$array['id'];
$registration=$array['reg_no'];
$country=$array['country'];
$email=$array1['email'];
if($subscountry[$i]==$country){
echo $id." ".$registration." ".$country." ";
}
}
}
}
mail($email,"xxxxxx","xxxxxx","xxxxxx")."<br>";
}
?>But the problem is that $email still appear (which means that mail() will be still executed) although no records was found
Can anyone help me arrange this code, they must be wrongly looped