Solved

Python mysql update error

Posted on 2015-02-22
1
182 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 82

Accepted Solution

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

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Installing Python 2.7.3 version on Windows operating system For installing Python first we need to download Python's latest version from URL" www.python.org " You can also get information on Python scripting language from the above mentioned we…
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…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
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…

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now