...

View Full Version : select and insert together get following errot message



dave14
12-04-2010, 02:35 PM
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?

abduraooft
12-04-2010, 02:48 PM
Please follow 1.2) of http://www.codingforums.com/rules.htm

dave14
12-04-2010, 02:52 PM
sorry new to this but can u see whats im diong wrong

abduraooft
12-04-2010, 02:54 PM
sorry new to this but can u see whats im diong wrong
I've replied to your other post.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum