simple select statement

wxdqz

New Member
After a couple of years of perl coding I am delving into php, and have come accross this little select statement that is tripping me up.
suppose
$VarOne = "A";
$VarTwo = "B";
$st = "SELECT * FROM Table WHERE FieldOne = '$VarOne' AND FieldTwo = '$VarTwo' ";
for some reason this kind of statement produces an error of "Unknown column 'blah' in 'where clause' " --- where blah displays the value of $VarOne

However if I specify the values in the sql statement such as
$st = SELECT * FROM Table WHERE FieldOne = 'A' AND FieldTwo = 'B' ";
everything will work just fine

my problem seems to be the usage of single quotes '
but I cant seem to figure out what is going wrong here.

any help would be appreciated
kevin
 
Back
Top