MySQL query with multiple 'OR' statements

后端 未结 3 397
粉色の甜心
粉色の甜心 2021-01-27 11:39

I have a query, that I have tested outside of PHP directly on SQL and still getting the same problem

The idea being that $currentArtist is sent through using the GET met

相关标签:
3条回答
  • 2021-01-27 11:51
    SELECT *
      FROM events e
     WHERE '$currentArtist' IN (e.event_artist1,e.event_artist2,e.event_artist3);
    
    0 讨论(0)
  • 2021-01-27 12:05

    try

    SELECT * FROM `".DBN."`.`events` WHERE
                `event_artist1`= '".$currentArtist."' OR `event_artist2`= '".$currentArtist."' OR `event_artist3` = '".$currentArtist."'";
    
    0 讨论(0)
  • 2021-01-27 12:14
    SELECT *
    FROM `".DBN."`.`events`
    WHERE `event_artist1` = '".$currentArtist."' 
    OR `event_artist2` = '".$currentArtist."' 
    OR `event_artist3` = '".$currentArtist."'
    ";
    

    Hope this helps.

    0 讨论(0)
提交回复
热议问题