Documentation Confirmation
You cannot use the handle of a named parameter with the same name twice in a prepared expression. You cannot bind multiple values ββto a single named parameter in, for example, the IN () clause of an SQL statement.
In this case you should use something like
$query = $db->prepare('(SELECT last_visit, last_ip FROM user_log WHERE user_id = :id_1 ) UNION (SELECT time AS last_visit, packet_hex AS last_ip FROM crack_log WHERE target_id = :id_2 ) ORDER BY last_visit DESC LIMIT 0,10;' ); $query->execute(array(':id_1'=> $_SESSION['id'], ':id_2'=> $_SESSION['id'] ) );
source share