Notice: Undefined index: id in /var/www/goldend1/public_html/producer.php on line 50

Notice: Undefined index: id in /var/www/goldend1/public_html/producer.php on line 66

Notice: Undefined index: id in /var/www/goldend1/public_html/producer.php on line 79
/var/www/goldend1/public_html/producer.php 88
1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND b.id = p2b.brand_id
                        AND p2b.product_id = p2c.product' at line 5

SELECT a.title category_title, a.id category_id, a.item_id, b . *
              FROM (SELECT c.title, c.id, p2c.product_id, p2c.id item_id
                      FROM product2brand p2b, brands b, product2category p2c, categories c
                      WHERE p2b.brand_id =
                        AND b.id = p2b.brand_id
                        AND p2b.product_id = p2c.product_id
                        AND p2c.category_id = c.id
                        AND c.level = 2) a, 
                   (SELECT p.id, 
                           p.title as title, 
                           p.description, 
                           REPLACE(FORMAT(CONVERT(price, UNSIGNED), 0 ), ',', ' ') as price,
                           p.price pr, 
                           CONCAT('images/upload/',REPLACE(p.image,'.jp', '.thumb.jp')) as image,
                           image_x+8 image_x, image_y+9 image_y
                      FROM products p, product2brand p2b, brands b               
                      WHERE b.id =  
                       AND p2b.brand_id = b.id
                       AND p.id = p2b.product_id
                       AND p.id IN (SELECT product_id
                                      FROM product2category
                                      WHERE category_id = 0 OR 0 = 0)) b
              WHERE a.product_id = b.id
                AND (a.id = 0 OR 0 = 0) 
              ORDER BY a.id, b.pr ASC