vendredi 29 mai 2015

Moving code outside the for statement gives me a white page - PHP

So I've written this code which takes names from a text file and puts it in a table, but my problem is after I put something else below $Data the code stops working and all I get is a white page. I've tried to set all of the errors to true so it displays errors, but with no luck and the PHP error log files is also empty.

If I add this piece of code ($nameParsed = rawurlencode($Data[1]);), or any other below $Data, I get a white page, but if I move it below the $Data to after the table it works and it is still within the for statement.

I'm completely baffled, why does this happen? There is nothing wrong with the variable $nameParsed and everything else seems to be correct.

    <?php
    for ($i = 0; $i <= $totalMembers - 1; $i++) {
        $currentLine = $lines[$i];
        $Data = explode("\t", $currentLine)
    ?>
    <tr>
    <td style='text-align: center;'><?php echo $i + 1; ?></td>
    <td class='member' style='padding-left:16px;'><?php echo $Data[1]; ?></td>
    <td style='padding-left:15px;'>117</td>
    <td class='member' style='text-align: center;'>94</td>
    <td class='member' style='text-align: center;'>94</td>
    <td class='member' style='text-align: center;'>94</td>
    <td class='member' style='text-align: center;'>97</td>
    <td class='member' style='text-align: center;'>92</td>
    <td class='member' style='text-align: center;'>70</td>
    <td class='member' style='text-align: center;'>94</td>
    </tr>
    <?php
    $nameParsed = rawurlencode($Data[1]);
    }

Aucun commentaire:

Enregistrer un commentaire