1

In the following code:

print(str(processedEmails))
print(campaignId)

returns values I was expecting.

What I'm trying to do (why I ran print() statements to check):

cursor.execute('UPDATE campaigns SET campaign_finish_date = (NOW()) AND queue_size =' + str(processedEmails) + ' WHERE id=' + campaignId)

checking via phpMyAdmin:

NOW() = 0000-00-00 00:00:00.000000
campaignId = 0 (what I set as default)

Values not transferred.

What am I doing wrong?

1 Answer 1

1

Assuming you're using MySQLdb module, you need to commit() the query if autocommit() is False (default).

See this.

Edit #1:

Then grant that the query is being successfully executed. Have you tried to execute that query via phpMyAdmin? Does it work as expected?

I've noticed that you've a AND instead a comma (',') on your update query:

You've this:

cursor.execute('UPDATE campaigns SET campaign_finish_date = (NOW()) AND queue_size =' + str(processedEmails) + ' WHERE id=' + campaignId)

Instead of this:

cursor.execute('UPDATE campaigns SET campaign_finish_date = (NOW()), queue_size =' + str(processedEmails) + ' WHERE id=' + campaignId)
Sign up to request clarification or add additional context in comments.

2 Comments

Yea--ran into that problem early on, but I have the commit() in my code. Will edit my post to show [but yea...def issue among many people]
that fixed it. heh... syntax :\ ..thank you so much!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.