this means that the select-statement did not return a row. try printing out the select-statement and execute it on the command-line. and add a "if ($result) {..." before using the result set.
and: try finding a php-list. :-) > -----Original Message----- > From: Alia Mikati [mailto:[EMAIL PROTECTED]] > Sent: Friday, April 12, 2002 3:13 PM > To: [EMAIL PROTECTED] > Subject: functions in mysql again > > > Hi again > I'm getting this message now: > Supplied argument is not a valid MySQL result resource ..at the 4th line. > What could be the problem now? > Thx again > > function AddItem($OrderID,$ProductID,$Qty) > { > $Datasource = new Datasource; > $result = mysql_query("Select Count(*) FROM orderitemdetail WHERE > Product_Id=$ProductID AND Order_Id=$OrderID"); > $row = mysql_fetch_row($result); > > if ($row[0]>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 > --------------------------------------------------------------------- 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