I'm trying to select a particular row using jquery from a looped foreach. For now I'm just using a simple alert to see if I get the right row. Problem is, it only selects the last row, and not the row I clicked.
Example code:
     <?php foreach ($customers as $c) : ?>
            <tr>
                <td><?php echo $count++; ?></td>
                <td><?php echo $c['firstname'] . " " .  $c['lastname']; ?></td>
                <td><?php echo $c['phone']; ?></td>
                <td><?php echo $c['email']; ?></td>
                <td style="display:none" id="'<?php echo $c['id'] ?>'"> </td>
            </tr>
    <?php endforeach ?>
The Jquery call:
    $('tr td ').click(function(){
    var fn = '<?php echo $c['firstname']; ?>';
    alert(fn);}
    );
 
     
     
    