Solved

Python mysql update error

Posted on 2015-02-22
1
191 Views
Last Modified: 2015-02-22
I am trying to update a table (customerorder) for columns CustomerID, DelDate,DelTime and TotalCost - in row where (in this example) Key OrderID = 323. The function 'UpdateCustomerOrderinfo' below is used within the action page which supports the input form.

The error message below indicates some subtle syntax code. Hopefully you might spot it.

Tks for any assistance

def UpdateCustomerOrderInfo(db,cursor):
      cursor.execute ("""
         UPDATE customerorder
         SET CustomerID=%s, DelDate=%s, DelTime=%s, TotalCost=%s
         HAVING OrderID=%s
      """, (CustomerID, DelDate, DelTime, TotalCost, OrderID)) 

Open in new window



rs.ProgrammingError: 1064 (42000): 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 'HAVING OrderID='423'' at line 3

Open in new window

0
Comment
Question by:jameskane
1 Comment
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 40623963
I think you need to use WHERE instead of HAVING.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here I am using Python IDLE(GUI) to write a simple program and save it, so that we can just execute it in future. Because when we write any program and exit from Python then program that we have written will be lost. So for not losing our program we…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question