On 2/1/07, Paul Issott <[EMAIL PROTECTED]> wrote:
Hi, I'm a newbie using sqlite 3 via Python 2.5, I've created a db using
CREATE TABLE messages (
id INTEGER PRIMARY KEY,
subject TEXT
)
Populated it with a few lines and one of the row of rows is (1, u'News')
after:-
rows = curs.fetchall()
How do I pass these parameters in a cgi script, for instance I've tried
using:-
print '<p><a href="view.cgi?id=row[0]">row[1]</a></p>'
which only prints _row[1]_ instead of _News_
and probably doesn't set the id either.
your question actually has nothing to do with SQLite, but instead
relates to Python and CGI. I know nothing about Python, but in my
world (Perl/CGI), I would do
Given --
CREATE TABLE messages (
id INTEGER PRIMARY KEY,
subject TEXT
)
In my code --
$sth = $dbh->prepare(qq{
SELECT id, subject
FROM messages
});
$sth->execute;
And then, in my html (I would never do it this way as I would use a
template, but anyhow) --
while (my $row = $sth->fetchrow_arrayref) {
print "<p><a href='view.cgi?id=$row[0]'>$row[1]</a></p>";
}
$sth->finish;
--
Puneet Kishor http://punkish.eidesis.org/
Nelson Inst. for Env. Studies, UW-Madison http://www.nelson.wisc.edu/
Open Source Geospatial Foundation http://www.osgeo.org/education/
---------------------------------------------------------------------
collaborate, communicate, compete
=====================================================================
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------