You have an error in your SQL syntax near 'FROM painting, WHERE painting.id_category = .id and .id = ' at line 6