http://www.perlmonks.org?node_id=1060039


in reply to problem with login script

Two suggestions.

  1. Change:
    #!C:/Perl64/bin/perl.exe
    use DBI;

    to

    #!C:/Perl64/bin/perl.exe
    use strict;
    use warnings;
    use DBI;

    and;
     

  2. Change:
    $sth = $dbh->prepare("SELECT username, password FROM users WHERE username =$username and password=$password");

    to

    my $sqlStatement = "SELECT username, password FROM users WHERE username =$username and password=$password";
    print "Submitting:  $sqlStatement\n";
    $sth = $dbh->prepare($sqlStatement);

     

See what the full SQL statement looks like; you are likely to find an error there, since that's what your error message says.

Most SQL requires strings to be encapsulated in single-quotes:  ... and password = 'newpassword';

Dunno if that's your problem, but the above changes should help shed light on what you are getting wrong in the SQL statement.