Why Do I Keep Getting Php Error Saying Unexpected ')' In For Statement?
I am programming an HTML 10x10 table, Each cell with a separate ID and link. It was taking way to long with copying and pasting and changing so I decided to use PHP, using the FOR
Solution 1:
Use a semicolon (;
) in your for
loop (instead of a comma).
And please indent your code, it makes it a lot easier to read...
Something like this:
for ($r=1; $r<10; $r++) {
echo"<TR>";
for ($d=1; $d<10; $d++) {
echo"<TR id='d".$d."r".$r."'><a href='javascript: void(0)' onclick='"
."shoot(".$d.",".$r.")'>SHOOT!</a>";
}
echo"<TD>";
}
Solution 2:
Try using ;
instead of ,
to delimit the statements in the for loop expression. You can read more about php's for loop syntax here.
Solution 3:
The for
syntax is:
for(intro; comp; inc) expr;
Notice the ;
instead of ,
inside the for
.
Solution 4:
Don't for loops have the conditions separated by semicolons?
Solution 5:
for ($r=1, $r<10,$r++)
should be
for ($r=1; $r<10; $r++)
Your for statements are using commas instead of semi-colons.
The PHP Manual can be a big help.
Post a Comment for "Why Do I Keep Getting Php Error Saying Unexpected ')' In For Statement?"