Transfer data from webpage form to database

Jerry Sievers jerry at jerrysievers.com
Tue Nov 23 15:46:41 EST 2004


"Pete....." <helten0007 at yahoo.com> writes:

> Hi again and thanks.
> I think I understand the meaning of string formatting operators, I also 
> understand the meaning with % (form['name'].value, form['surname'].value, 
> form['username'].value)) And that it is a dictionary that I use.
> 
> The thing I find really hard to understand is how I can send the data from 
> the webform to my postgresql database. I cant find the right commands, i 
> been searching the web for days now without luck.
> 
> PgSQL.query(''' INSERT into form Select persons.idpersons, person.username,
> 

You mean that whatever docs for the PgAPI that you are using don't
explain?

I am using pygresql.  There are others.

from pgdb import connect

conn = connect(database = 'db', username = 'user', password = 'passwd')
cursor = conn.cursor()

cursor.execute("insert into foo values (1)")
conn.commit()

That's about all the help I can give you.

Good luck

-- 
-------------------------------------------------------------------------------
Jerry Sievers   305 854-3001 (home)     WWW ECommerce Consultant
                305 321-1144 (mobile	http://www.JerrySievers.com/



More information about the Python-list mailing list