-1

Here is my code, I check all closing & open brace,I also not use its short form of php anywhere & i don't miss ';',
I don't know why Its shows parse error:

<html>
 <head>

  <script type="text/javascript" src="<?php echo base_url('assests/js/jquery.min.js') ?>"></script>
  <link rel="stylesheet" type="text/css" href="<?php echo base_url('assests/css/bootstrap.min.css') ?>">
  <script type="text/javascript" src="<?php echo base_url('assests/js/bootstrap.min.js') ?>"></script>
 </head>
  <body>
   <div class="container">
    <table class="hover hover-table">
       <tr>
        <th>No</th>
        <th>Code</th>
        <th>Name</th>
        <th>Address</th>
       </tr>
       <?php if(count($all_user>0))
         { $i=0;
       foreach ($all_user as $user) 
          {

           $i++;
       ?>
     <tr>
      <td><?php echo $i ?></td>
      <td><?php echo $user->code ?></td>
      <td><?php echo $user->name?></td>
      <td><?php echo $user->address ?></td>
    </tr>
         }
      }
  </table>
 </div>

  </body>
  </html>
Sagar Parikh
  • 288
  • 5
  • 20

2 Answers2

3

You are missing to open and close php

    </tr>
    <?php } /* endforeach */
      } /* endif */ ?>
  </table>

That's why you are getting errors.

Ayaz Ali Shah
  • 3,453
  • 9
  • 36
  • 68
2

You're missing the closing php tags before curly braces <?php }}. Becasue of that you're getting Line : 36 -- syntax error, unexpected end of file

Try this way,

<html>
 <head>
  <script type="text/javascript" src="<?php echo base_url('assests/js/jquery.min.js') ?>"></script>
  <link rel="stylesheet" type="text/css" href="<?php echo base_url('assests/css/bootstrap.min.css') ?>">
  <script type="text/javascript" src="<?php echo base_url('assests/js/bootstrap.min.js') ?>"></script>
 </head>
  <body>
   <div class="container">
    <table class="hover hover-table">
       <tr>
        <th>No</th>
        <th>Code</th>
        <th>Name</th>
        <th>Address</th>
       </tr>
       <?php if(count($all_user>0))
         { $i=0;
       foreach ($all_user as $user) 
          {

           $i++;
       ?>
     <tr>
      <td><?php echo $i ?></td>
      <td><?php echo $user->code ?></td>
      <td><?php echo $user->name?></td>
      <td><?php echo $user->address ?></td>
    </tr>
       <?php
         }
       }
      ?>
  </table>
 </div>

  </body>
  </html>
A l w a y s S u n n y
  • 36,497
  • 8
  • 60
  • 103