error in mysql syntax

Discussion in 'MySQL' started by promotingspace.net, Nov 7, 2008.

  1. #1
    Hi
    can you help me with this error:
    
    select *,UNIX_TIMESTAMP(sb_postedon) as ondate from b2b_members join b2b_offers on b2b_members.sb_id=b2b_offers.sb_uid where b2b_offers.sb_approved='yes' and DATE_ADD(b2b_offers.sb_postedon,INTERVAL MONTH) > NOW() and b2b_offers.sb_id in (-1,2,2,3,3,4,5,6,7,8,9,10,11,22,23,24,25,110,109,108,107,106,67,68,69,70,71,72,72,72,72,96,95,94,93,92,79,80,81,82,91,105,104,103,102,101,100,99,98,98,98,98,98,111,111,132,133,134,135,136,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,430,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,218,231,219,232,196,197,198,199,321,320,319,318,204,207,208,209,210,211,212,213,220,221,222,223,224,225,226,227,228,229,230,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,257,258,259,260,261,262,263,264,265,266,267,269,270,271,276,277,278,279,280,281,282,287,288,289,290,291,292,293,294,295,298,299,304,305,306,307,309,310,438,357,437,436,514,316,317,326,327,328,329,330,331,332,333,334,520,340,458,519,343,344,345,346,347,348,349,350,351,352,353,354,359,360,435,362,363,364,367,368,369,370,371,372,377,378,379,380,381,382,383,384,385,386,387,389,390,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,431,432,433,434,439,440,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,460,461,462,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,501,502,503,504,505,506,507,508,509,510,511,512,513,515,516,517,518,521,522,523) order by b2b_members.sb_memtype desc 
    
    PHP:
    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 ') > NOW() and b2b_offers.sb_id in (-1,2,2,3,3,4,5,6,7,8,9,10,11,22,23,24,25,110,' at line 1
     
    promotingspace.net, Nov 7, 2008 IP
  2. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #2
    INTERVAL MONTH will not work.

    It needs to be formatted like: INTERVAL 1 MONTH
     
    jestep, Nov 8, 2008 IP