 <p><code>IF</code> needs 3 arguments. You've only provided 2. Change your sql to something like:</p> <pre><code> $sql = 'SELECT if(turnier = "Company Friends", "Company", "Something here"), ... </code></pre> <p>First one is condition, second will be returned if condition is satisfied, third if not.</p>