MySQL UNION Help

Discussion in 'MySQL' started by Seph, Dec 28, 2006.

  1. #1
    I have a problem with a UNION query.

    This is the query:
    http://pastebin.dk/index.php?show=2613

    The resulting array is the following:
    array(2) { ["current"]=> string(1) "1" ["force_fallback"]=> string(1) "1" }

    In my mind it should give the following array:
    array(2) { ["current"]=> string(1) "1" ["force_fallback"]=> string(1) "1", ["default"]=> string(1) "2" }

    I'm using MySQL 5.1.14-beta-community-nt, and when running the queries seperatly I get the proper fields, ["current"] and ["force_fallback"] or ["default"] and ["force_fallback"] I'm really uncertain of how to fix this.
     
    Seph, Dec 28, 2006 IP
  2. kajakske

    kajakske Well-Known Member

    Messages:
    139
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    165
    #2
    Why are you using the union for this ?

    Isn't it easier to adjust your where clause to look liek this:

    WHERE
    `page` = "index" AND
    (`language` = "' . $this->lang . ' OR `language` = "' . $this->_default_lang . '")';

    (give or take some quotes ;-))
     
    kajakske, Dec 29, 2006 IP