-2

I copied a source code from youtube, i did it properly with mysql, but there's showing a big problem woth "endif"

<?php
<?php for($x = 1; $x <= $pages; $x++); ?>
            <a href="?pages=<?php echo $x; ?>&per-page=<?php echo $perPage; ?>"><?php echo $x;?></a>
        <?php endfor; ?>
Mark Baker
  • 209,507
  • 32
  • 346
  • 385
AkrAm Khan
  • 9
  • 1
  • 2

1 Answers1

1

Change for(...); to for(...):

<?php for($x = 1; $x <= $pages; $x++): ?> //<-- change ; to :
        <a href="?pages=<?php echo $x; ?>&per-page=<?php echo $perPage; ?>"><?php echo $x;?></a>
<?php endfor; ?>
Jacek B Budzynski
  • 1,393
  • 1
  • 7
  • 13
  • @Michael are you sure? ` ` show error **Parse error: syntax error, unexpected 'endfor' T ENDFOR** however ` ` run property. I don´t know what is do rest of code because it´s not a question. – Jacek B Budzynski May 19 '16 at 08:00
  • @Michael I can´t comented your answer but is not recomended mix html inside php code It is not a recomended conduct by an good programmer – Jacek B Budzynski May 19 '16 at 08:10
  • Executing the above code returns a HTML500 code. I didn´t took the time to figure out the problem. – Michael May 19 '16 at 08:13
  • regarding the Mixup... this is a small sniplet, if you want it the correct way you should use templates, but as far as you already mentioned the rest of the code is missing. – Michael May 19 '16 at 08:22