Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7955239
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:40:11+00:00 2026-06-04T03:40:11+00:00

I use mysqldb to insert a row: def insertNewLog(self,uid,beginDate,endDate,logs): qry1 = INSERT INTO logs

  • 0

I use mysqldb to insert a row:

 def insertNewLog(self,uid,beginDate,endDate,logs):
        qry1 = """INSERT INTO logs (owner,createDate,endDate,log) VALUES (%s,%s,%s,%s); """ 
        cursor = self.db.cursor()
        beginDate = int(time.mktime( beginDate.timetuple() ))
        endDate = int(time.mktime( endDate.timetuple()))
        print beginDate
        print endDate 
        cursor.execute(qry1,(uid,beginDate,endDate,logs),)
        print "inserted normally"
        print "Number of rows inserted: %d" % cursor.rowcount

I get this output:

1337720045
1337740625
inserted normally
Number of rows inserted: 1

However when I do a select on my database in mysql shell I get ’empty set’. I check my mysql logs and there is nothing reported in there. I’m a bit baffled.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T03:40:13+00:00Added an answer on June 4, 2026 at 3:40 am

    you should probably call commit() on your db connection. otherwise the insert is rolled back.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using MySQLdb, I use: cursor.execute(QUERY) Where QYERY is: INSERT (A,B,C) VALUES(%s,%s,something);'%(k1, u'W')** w
I have create a DB and i use Mysqldb. I want to insert and
when I use MySQLdb get this message: /var/lib/python-support/python2.6/MySQLdb/__init__.py:34: DeprecationWarning: the sets module is deprecated
I use Python/MySQLdb frequently and often format a list of categories for MySQL. The
Why do people use SQLAlchemy instead of MySQLdb? What advantages does it offer?
After I installed MySQLdb by sudo apt-get install python-mysqldb I can import and use
I have to insert some data into a MySQL table. The data will be
I am developing java web services (JAX-WS) to insert data into mysql DB and
code: # A: $dbh->do(qq/insert into foo(cl) values('test')/); # B: $dbh->do(qq/insert into foo(cl) values('test')/) or
I'm using Python and its MySQLdb module to import some measurement data into a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.