开发者

Python/MySQL: Query executes but nothing happens?

I'm executing a simple query with Python but nothing seems to happen when it executes, just as if it sk开发者_如何学Pythonipped the execution.

Here's the code:

def somefunction(search_query):
    from django.db import connection, transaction

    search_query = search_query.strip()
    cursor = connection.cursor()
    rows = cursor.execute("INSERT INTO searches (query) VALUES ('"+ search_query +"')")

There's nothing wrong with the query, i get no error message or nothing, it's just not working!

Any ideas?


Perhaps you have to commit your changes:

cursor.execute('COMMIT')
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜