I'm using sqlite for my perl cgi website but I've got a problem with the
following select statement...

SELECT userID FROM members WHERE userName='John' AND
userOccupation='Carpenter'

Yet if I input this statement from the sqlite3 command prompt it works! The
problem seems to be with the 'and', the following statement works fine in
both cgi script and from the sqlite3 prompt...

SELECT userID FROM members WHERE userName='John'

I hope somebody can help with this, I'm new to both perl and sqlite but very
keen on using sqlite for future projects.



here is my perl script...


#!/usr/bin/perl

use DBI;

my $output;
my $sql = "SELECT userID FROM members WHERE userName='John' AND
userOccupation='Carpenter'";

my $dbh = DBI->connect("dbi:SQLite:test.db", "", "");
my $sth = $dbh->prepare($sql);
$sth->execute();

  while ( @row = $sth->fetchrow_array ) {
    $output .= "@row\n";
  }

$dbh -> disconnect;

print "Content-type:text/html\n\n";
print "<html><body><h1>Hello World</h1> $output </body></html>";

-- 
View this message in context: 
http://www.nabble.com/newbie-problem-with-select-statement-using-%27AND%27-tp19561141p19561141.html
Sent from the SQLite mailing list archive at Nabble.com.

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to