Web Analytics Made Easy -
StatCounter parse error, expecting `T_STRING' in alternating colors script - CodingForum

Announcement

Collapse
No announcement yet.

parse error, expecting `T_STRING' in alternating colors script

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • parse error, expecting `T_STRING' in alternating colors script

    This is throwing that parse error. Is there a misuse or ' or "?

    PHP Code:
    <?php 
    for ($cnt=0;$cnt<=$count-1;$cnt++){ 
    $row_color = ($cnt 2) ? 'class="white"' 'class="grey"'
    $id $cnt 1
    $display_date date("F j, Y",$farray[mod][$cnt]); 
    echo<<<
    EOB
    <
    tr
       <
    td $row_color><strong>$id</strong></td
       <
    td $row_color>&nbsp$farray['descr'][$cnt]</td>                
       <
    td $row_color align="center">$farray['counter'][$cnt]</td
       <
    td $row_color>$display_date</td
    </
    tr>   
    EOB 

    ?>
    Last edited by AshleyQuick; Feb 14, 2004, 03:33 PM.

  • #2
    not really enough of the script to go on there, Ashley.

    Here are a few things i'd change:

    - at the end (the EOB), move the semicolon up to the same line
    - the line calling the display_date.....is 'mod' a constant? If not, and it's a variable, then it needs a $. if not a variable, but something like $farray['descr'], then it needs to be quoted.
    - I would change the row color line to read
    PHP Code:
    $row_color = ($cnt 2) ? "class=\"white\"" "class=\"grey\""
    It is difficult to troubleshoot scripts like this without all the code. Why?

    Because I can't copy the code and try to test it... I have no clue what $count or $farray are!


    please enclose your code with the [ php ] and [ /php ] tags for legibility.

    -Celt

    Comment

    Working...
    X