1. PHP / Говнокод #8667

    +176

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    $query = "
    			SELECT `ord`.*,`cus`.`existing_phone_number`,`cus`.`nova_jednotka`,
    				`cus`.`order_phone`,`cus`.`custom_delivery_date`, `cus`.`delivery_address`,
    				`cus`.`invoice_address`, `cus`.`invoice_street`, `cus`.`invoice_street_number`,
    				`cus`.`invoice_city`, `cus`.`invoice_zip`
    			FROM ".(!empty($_GET["copy_view"]) && $_GET["copy_view"] == 1 ? "`orders`" : "`".$this->table."`")." AS `ord`,
    				`products`, `navigace`, `customers` AS `cus`
    			WHERE `ord`.`order_id` = ".$order_id."
    				AND `ord`.`id_produktu_db` = `products`.`id`
    				AND `products`.`navigace_polozka_id` = `navigace`.`id`
    				AND `cus`.`id` = `ord`.`customers_id`
    			union all
    			select
    				null, null, null, null, null, null, null, null, null, null,
    				null, null, null, null, null, null, null, null, null, null,
    				null, null, null, null, null, null, null, null, null, null,
    				null, null, null, null, null, 
                                    '', tp.description, tp.product_id, tp.activation_price, tp.activation_price_EUR,
    				0, tor.pocet_kusu, tp.name, null, null, null, null, null, null, null,
    				null, null, null, null, null, null, null, null, null, null,
    				null, null, null, null, null, null, null, null, null, null,
    				null, null, null, null, null, null, null, null, null, null,
    				null, null, null, null, null, null, null, null, null, null,
    				null, null, null, null, null, null, null, null, null, null, 
                                    null, null, null, null, null, null, null, null, null, null, null, null, null
    			from tarifs_prop tp
    			inner join tarifs_orders tor on tp.id = tor.tarif_prop_id
    			where tor.order_id = ".$order_id."
    			union all
    			select
    				null, null, null, null, null, null, null, null, null, null,
    				null, null, null, null, null, null, null, null, null, null,
    				null, null, null, null, null, null, null, null, null, null,
    				null, null, null, null, null, '', b.description, b.product_id, b.activation_price, b.activation_price_EUR,
    				0, tor.pocet_kusu, b.name, null, null, null, null, null, null, null,
    				null, null, null, null, null, null, null, null, null, null,
    				null, null, null, null, null, null, null, null, null, null,
    				null, null, null, null, null, null, null, null, null, null,
    				null, null, null, null, null, null, null, null, null, null,
    				null, null, null, null, null, null, null, null, null, null, 
                                    null, null, null, null, null, null, null, 
                                    null, null, null, null, null, null
    			from balicky b
    			inner join tarifs_orders tor on b.id = tor.tarif_balicek_id
    			where tor.order_id = ".$order_id."
    			ORDER BY `user_id` desc";

    а филе нам кабанам, надо продукты из разных таблиц объединить в одну, ну и фто што таблицы разного размера. Зато когда добавляешь новый столбец в таблицу, нужно вручную считать сколько раз нужно добавить null :D

    Запостил: Lameaux, 29 Ноября 2011

    Комментарии (12) RSS

    Добавить комментарий