# Group Name Case Sensitivity Fix

## Problem Description
When changing a student's group in the system, the marks entry page was not showing the student's information. This happened because:
1. Student group names were stored with inconsistent casing (e.g., "Science" vs "SCIENCE")
2. Database queries were doing exact case-sensitive matching
3. This mismatch caused the system to not find matching records between students and subject mark distributions

## Solution Implemented
Updated the database queries to use case-insensitive comparisons for group names by using the `UPPER()` function to normalize both sides of the comparison.

### Files Modified

1. **marks/entry.php** - Updated multiple queries to use case-insensitive group name matching:
   - Mark distribution lookup
   - Student filtering by group
   - Results filtering by group

2. **students/edit.php** - Updated duplicate roll number checking to use case-insensitive group matching

### Technical Details

#### Before (Case-Sensitive):
```sql
AND group_name = ?
```

#### After (Case-Insensitive):
```sql
AND (group_name = ? OR UPPER(group_name) = UPPER(?))
```

This approach maintains backward compatibility while allowing flexible matching regardless of case.

## Testing
Created a test script (`test_group_fix.php`) that verifies the fix works with various case combinations:
- Science / SCIENCE / science
- Arts / ARTS / arts

## Impact
- Fixes the issue where students weren't appearing in marks entry after group changes
- Makes the system resilient to case variations in group names
- Maintains compatibility with existing data

## How to Verify the Fix
1. Navigate to: http://localhost/bidda/students/edit.php
2. Change a student's group (e.g., from "Science" to "SCIENCE" or vice versa)
3. Go to marks entry: http://localhost/bidda/marks/entry.php
4. Select the same subject, class, session, and group
5. The student should now appear in the list

Alternatively, run the test script: http://localhost/bidda/test_group_fix.php