0
$tablecode1 = "<table>"; $column = 3; $rows = 2;

for ($m=1; $m<=$column; $m++){
    $tablecode1.="<tr>"
    for ($n=1; $n<=$rows; $n++){ 
        $tablecode1.="<td>$n-$m</td>";
    }
    $tablecode1.="</tr>";
}

$tablecode1.="</table>";
echo "$tablecode1";

Parse error: syntax error, unexpected 'for' (T_FOR) in line @ second for

The first $tablecode1 should have value of "<table>". idk why it didnt show up.

Sirko
  • 72,589
  • 19
  • 149
  • 183
Afk Afk
  • 13
  • 4

1 Answers1

0

I see the missing semicolon (";") on the second line.

for ($m=1; $m<=$column; $m++){
    $tablecode1.="<tr>" ; // <<== You are missing a semicolon.
Petr Fořt Fru-Fru
  • 858
  • 2
  • 8
  • 23
  • it bothers me for like 30+ mins.. Thanks for the answer.. I feel so bad :'( – Afk Afk Feb 23 '20 at 11:14
  • We are only human. This becomes fatigue. Please can you accept my answer? @Afk Afk – Petr Fořt Fru-Fru Feb 23 '20 at 11:17
  • Questions that are about basic PHP syntax errors should not be answered. They should be closed as a duplicate of [PHP Parse/Syntax Errors; and How to solve them?](//stackoverflow.com/questions/18050071) only. If you want to point out their mistake, just post a comment. See: [Should one advise on off topic questions?](//meta.stackoverflow.com/q/276572/1768232). Off-topic questions can be closed and deleted, which could nullify your contribution anyway. – John Conde Feb 23 '20 at 13:11