SQL connecting

Scripter47 nospam at riddergarn.dk
Mon Jan 29 10:47:10 EST 2007


Hey

It got a problem with python to connect to my SQL DBs, that's installed
on my apache server. how do i connect to sql? Gettting data? Insert into it?

it is a localserver with php if that means something

here is a *REALLY* dirty solution that a have used:
[CODE]
from urllib import *
# sql query
s = 'INSERT INTO `test` (`test`) VALUES ("1");'

# encode and insert into db
params = urlencode({'sql': sql})
urlopen("http://localhost/in/sql.php?%s" % params)
[/CODE]

-- 
   _________            .__        __                  ______________
  /   _____/ ___________|__|______/  |_  ___________  /  |  \______  \
  \_____  \_/ ___\_  __ \  \____ \   __\/ __ \_  __ \/   |  |_  /    /
  /        \  \___|  | \/  |  |_> >  | \  ___/|  | \/    ^   / /    /
/_______  /\___  >__|  |__|   __/|__|  \___  >__|  \____   | /____/
         \/     \/         |__|             \/           |__|





More information about the Python-list mailing list