简体   繁体   中英

MySQLi query returns bool(false) even knowing the SQL is correct

The following query returns bool(false) when dumping the query:

        SELECT *
        FROM `account` 
        LEFT OUTER JOIN `player` ON `account`.`uid` = `player`.`account_uid` 
        UNION 
        RIGHT OUTER JOIN `player` ON `account`.`uid` = `player`.`account_uid`

I know that if the query returns false there was an error with the SQL however I'm sure the syntax is correct, I even ran it successful in my console and on phpMyAdmins SQL tool.

If I run it without

        LEFT OUTER JOIN `player` ON `account`.`uid` = `player`.`account_uid` 
        UNION 
        RIGHT OUTER JOIN `player` ON `account`.`uid` = `player`.`account_uid`

all is working.

What is the problem with my query?

Thanks in advance.

I managed to fix it myself by adding another

SELECT * FROM `account`

to the query. The full query now looks like this:

    SELECT *
    FROM `account` 
    LEFT OUTER JOIN `player` ON `account`.`uid` = `player`.`account_uid` 
    UNION 
    SELECT *
    FROM `account`
    RIGHT OUTER JOIN `player` ON `account`.`uid` = `player`.`account_uid`

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM