Question: I am trying to use two `TapGestures` on two labels, but it always shows the result of last one TapGesture. My code is as follows:

```
 [write_review_label addGestureRecognizer:[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(open_view:)]];
[map_image addGestureRecognizer:[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(open_view:)]];
write_review_label.tag = 1;
map_image.tag = 2;

-(void)open_view:(UITapGestureRecognizer *)recog1
{
NSLog( @"recog1.view.tag == %d",recog1.view.tag);
if (recog1.view.tag==2)
{
    [self performSegueWithIdentifier:@"mapsegue" sender:self];
}
else
    [self performSegueWithIdentifier:@"loginsegue" sender:self];
 }

```

Answer: 
you would need to take item\_name as param and put in quotes, 

```
String sql="SELECT id,price FROM item WHERE item.name='"+ item_name+"'";

```
Try to avoid this type of mistake by using [PreparedStatement](http://docs.oracle.com/javase/tutorial/jdbc/basics/prepared.html) 

```
String sql="SELECT id,price FROM item WHERE item.name=?";  
PreapredStatement ps = con.prepareStatement(sql);
ps.setString(1,item_name); 
ResultSet rs = ps.executeQuery(); 

```

Use of PreparedStatement also [prevent SQL injection attack.](https://www.owasp.org/index.php/Preventing_SQL_Injection_in_Java)