Click to See Complete Forum and Search --> : Sql


piertiong
04-04-2003, 02:47 AM
what's wrong?

String s = "SELECT * from login WHERE id = '"+ userId + "' AND password = '" + userPw + "'";

Nedals
04-04-2003, 06:30 PM
If this is mySQL for Perl, then...

my $s = "SELECT * FROM login WHERE id = '$userId' AND password = '$userPw'";
where..
my is used in a strict enviroment (left out if not using strict.)
$s is a string variable (use $sql or $query instead, it's easier to debug later)
'login' is the name of the table (NOT a variable)
$userId and $userPW are variables.

Does that help?

piertiong
04-04-2003, 09:58 PM
Originally posted by nedals
If this is mySQL for Perl, then...

my $s = "SELECT * FROM login WHERE id = '$userId' AND password = '$userPw'";
where..
my is used in a strict enviroment (left out if not using strict.)
$s is a string variable (use $sql or $query instead, it's easier to debug later)
'login' is the name of the table (NOT a variable)
$userId and $userPW are variables.

Does that help?

sorry i am using it for jsp. thanks anyway for your reply!