Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: problem with login script

by marinersk (Priest)
on Oct 28, 2013 at 18:53 UTC ( [id://1060039] : note . print w/replies, xml ) Need Help??


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.