1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Can't figure out syntax error, need help!

Discussion in 'MySQL' started by MarkusTenghamn, Dec 19, 2011.

  1. #1
    Maybe i'm just tired but this is really bugging me, this is not working. where $invoiceid=1

    $checkfororder = mysql_query("SELECT * FROM shop_sales_flat_order WHERE ext_order_id = ".$invoiceid)or die(mysql_error());
    PHP:
    I get

    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 'WHERE ext_order_id = 1' at line 1
    Code (markup):
    I have also tried with no success

    $checkfororder = mysql_query("SELECT * FROM shop_sales_flat_order WHERE ext_order_id = '".$invoiceid."'")or die(mysql_error());
    $checkfororder = mysql_query("SELECT * FROM shop_sales_flat_order WHERE ext_order_id = $invoiceid")or die(mysql_error());
    $checkfororder = mysql_query("SELECT * FROM shop_sales_flat_order WHERE ext_order_id = '$invoiceid'")or die(mysql_error());
    PHP:
    Thanks for any help
     
    MarkusTenghamn, Dec 19, 2011 IP
  2. jestep

    jestep Prominent Member Premium Member

    Messages:
    3,542
    Likes Received:
    203
    Best Answers:
    18
    Trophy Points:
    330
    #2
    Possibly rewrite the entire query by hand. It's possible a hidden or other character is causing a problem. Do you have command line or phpmyadmin access to the database. Might try running it via command and see if it spits out the same error.
     
    jestep, Dec 20, 2011 IP
  3. MarkusTenghamn

    MarkusTenghamn Well-Known Member Premium Member

    Messages:
    654
    Likes Received:
    34
    Best Answers:
    16
    Trophy Points:
    145
    #3
    I have no problem running it in phpmyadmin.

    I rewrote the mysql statement and nothing changed

    Thanks for the help though
     
    MarkusTenghamn, Dec 20, 2011 IP