Hi I have a problem with this code. I want to compare the result of the query that should return the count number of the records in orderitemdetail. But its not working. What could be the problem? Thx a lot
function AddItem($OrderID,$ProductID,$Qty) { $Datasource = new Datasource; if (mysql_query("Select Count(*)AS numb FROM orderitemdetail WHERE Product_Id=$ProductID AND Order_Id=$OrderID")>0) { $SQL1 = "UPDATE orderitemdetail SET Quantity=Quantity+$Qty ". " WHERE Product_Id=$ProductID AND Order_Id=$OrderID"; } else { $SQL1 = "INSERT INTO orderitemdetail (Order_Id,Product_Id, Quantity)". "VALUES($OrderID,$ProductID,1)"; } $QueryResult = $Datasource->QueryDatasource($SQL1); return $QueryResult; } --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php