2015-02-15, 09:29 AM
> This is because after each echo, I made the page redirect.
Why don't you redirect after the three if statements finish?
How different will the redirect be if more than one statement results true?
Your code here is correct but unless you show more code we can't really help you further. Probably this may help you:
Why don't you redirect after the three if statements finish?
How different will the redirect be if more than one statement results true?
Your code here is correct but unless you show more code we can't really help you further. Probably this may help you:
if (!empty($array_intersect_1)) {
echo 'You have a duplicate entry for X';
$url = 'index.php?action=foo&error_type=x';
$update_array = array('error_type' => 'x');
}
if (!empty($array_intersect_2)) {
echo 'You have a duplicate entry for Y';
$url = 'index.php?action=foo&error_type=y';
$update_array = array('error_type' => 'y');
}
if (!empty($array_intersect_1) && !empty($array_intersect_2)) {
echo 'You have duplicate enetries for X and Y';
$url = 'index.php?action=foo&error_type=xy';
$update_array = array('error_type' => 'xy');
}
$db->update_query('foo', $update_array);
redirect($url);