PHP PDO/MySQL query not working properly
<p>So I have this website where people can report some tracks. People can do so even tho they're not member of said website and if they're not members, the system will assign them a random "pseudo member number" (pmn from here on) in the style of "not_a_member_XXXX".</p>

<pre><code>$query_claimed = "SELECT * FROM claims_archive WHERE t20pctID=:t20pctID AND member_name=:member_name AND member_email=:member_email AND (member_number=:member_number OR member_number LIKE '%not_a_member_%')"; 
$stmt = $con-&gt;prepare($query_claimed);
$stmt-&gt;bindParam(':t20pctID', $t20pctID);
$stmt-&gt;bindParam(':member_name', $member_name);
$stmt-&gt;bindParam(':member_number', $member_number);
$stmt-&gt;bindParam(':member_email', $member_email);
$stmt-&gt;execute();
</code></pre>

<p>In the testing period we have had some songs have been reported by the same person with a pseudo-number and some with a member number. My problem is that if I make a query with a pmn and the song exists with the same member name and e-mail but with another member number, the code will insert it instead of displaying a message in the style of "You have already claimed this song".</p>

<p>But if I do the query with the member number, then it will display the above message even if the record has it reported with a pmn.</p>

<p>I thought there was something wrong with my logic, but running the above query on phpMyAdmin, it does show the record if there is any matches. I have read about precedence, in case it applies here, and in case there's some operator order I should know about. What am I doing wrong?</p>

<p>Thanks in advance and I hope I made myself understood (English isn't my first or second language).</p>

<p>EDIT to add some info: although I haven't been able to identify a specific pattern for this issue, I have identified that it happens with this particular record.
<a href="https://i.stack.imgur.com/TxKyM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TxKyM.png" alt="enter image description here"></a></p>