Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Python

MySQLdb

 

 

Python python RSS feed   Index | Next | Previous | View Threaded


g.ricioppo at gmail

Nov 22, 2009, 6:36 AM

Post #1 of 1 (167 views)
Permalink
MySQLdb

Hi all.

I have a mod_python script with two query:

cursor = db.cursor()

sql = 'SELECT * FROM users where username=\'' + username +'\''
cursor.execute(sql)
result = cursor.fetchall()
num = int(cursor.rowcount)

if num == 0 :
sql2 = 'insert into users values (null, \'' + username + '\', \'' +
password +'\', \'no\',\'fdfdf\')'
cursor.execute(sql2)
warning = "Registration ok"
else :
warning = "EXIST!"

The first query is executed... but not the second. It doesn't insert.
Why?
I'm a newbie... sorry.

Many thanks.


K
--
http://mail.python.org/mailman/listinfo/python-list

Python python RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.