Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Nov 2010
    Posts
    13
    Thanks
    2
    Thanked 0 Times in 0 Posts

    select and insert together get following errot message

    thanks l put it in
    $sQry = "INSERT INTO reorder VALUES(cat_num,s_code,14,'2011-01-14','n') SELECT cat_num FROM product WHERE stock_no=0 AND NOT EXISTS
    (SELECT 1 FROM reorder WHERE product.cat_num = reorder.cat_code)";
    mysql_query($sQry) or die('Error in query: <br>'.mysql_error());

    this is the error message i get

    Error in query:
    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 'SELECT cat_num FROM product WHERE stock_no=0 AND NOT EXISTS (SELECT 1 FROM res' at line 1

    this seems to work ok on its own its when i add the insert
    SELECT cat_num FROM product WHERE stock_no=0 AND NOT EXISTS
    (SELECT 1 FROM reorder WHERE product.cat_num = reorder.cat_code)";
    l cant see whats wrong?

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,851
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    New Coder
    Join Date
    Nov 2010
    Posts
    13
    Thanks
    2
    Thanked 0 Times in 0 Posts

    sorry new to this but can u see whats im diong wrong

    sorry new to this but can u see whats im diong wrong

  • #4
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,851
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Quote Originally Posted by dave14 View Post
    sorry new to this but can u see whats im diong wrong
    I've replied to your other post.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •