in reply to showing the error ,Can't modify concatenation (.) or string in scalar assignment
As a side note you are making a mistake with this SQL query. Take a quick look at Exploits of a mom, SQL_injection. The DBI documetation has a section on Placeholders and bind variables, and links to references about SQL injection also Bobby Tables -> Perl.
Your code:
my $quer = "SELECT checklist.id FROM group_management,User_group_manag +ement_mapping,profiles,checklist,checklist_group_mapping WHERE User_g +roup_management_mapping.userid = $usr and profiles.userid = User_gro +up_management_mapping.userid and group_management.id =User_group_mana +gement_mapping.groupid and checklist_group_mapping.checklist_id = che +cklist.id and checklist_group_mapping.group_id = group_management.id" +; my $query = $dbh -> prepare($quer); $query-> execute();
Becomes:
my $SQLquery = " SELECT checklist.id FROM group_management, User_group_management_mapping, profiles, ch +ecklist,checklist_group_mapping WHERE User_group_management_mapping.userid = ? and profiles.userid = User_group_management_mapping.userid and group_management.id = User_group_management_mapping.groupid and checklist_group_mapping.checklist_id = checklist.id and checklist_group_mapping.group_id = group_management.id"; my $sth = $dbh->prepare( $SQLquery ); $sth->execute( $usr );
Note that I've changed some of the variable names you used, and made it a little easier to read IMHO.
|
|---|