MyBB Community Forums

Full Version: PHP Array Intersect Problem.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
> 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:
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);
I'll try the code and report back.
Pages: 1 2