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 Anveto, 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
     
    Anveto, Dec 19, 2011 IP
  2. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    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. Anveto

    Anveto Well-Known Member

    Messages:
    697
    Likes Received:
    40
    Best Answers:
    19
    Trophy Points:
    195
    #3
    I have no problem running it in phpmyadmin.

    I rewrote the mysql statement and nothing changed

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