title: Error printing out table rows
body: <p>I am trying to print out a table using data which i am fetching from the database.This is the code</p>
  
  <pre><code>&lt;?php
    $host = "localhost";
    $user = "root";
    $pass = "";
    $databaseName = "caliban";
    $tableName = "caliban";
    $con = mysql_connect($host,$user,$pass);
    $dbs = mysql_select_db($databaseName, $con);
    $result = mysql_query("SELECT * FROM $tableName");            //query
    $array = mysql_fetch_assoc($result);                          //fetch result   
    //--------------------------------------------------------------------------
    // 3) echo result as json
    //--------------------------------------------------------------------------
  $result = mysql_query("SELECT * FROM $tableName");            //query 
  
  $rows = Array();
  $i=0;
  while($row = mysql_fetch_assoc($result)){
          //array_push($rows, $row);
        $rows[$i++] = $row;
  }
  for($j=0;$j&lt;count($rows); $j++){
        echo
        "&lt;table&gt;&lt;tbody&gt;&lt;tr id='$rows[$j]['id']'&gt;
  &lt;td&gt;&lt;input type='checkbox' /&gt;&lt;/td&gt;
  &lt;td&gt;$rows[$j]['firstname']&lt;/td&gt;
  &lt;td&gt;$rows[$j]['lastname']&lt;/td&gt;
  &lt;td&gt;$rows[$j]['city']&lt;/td&gt;
  &lt;td&gt;$rows[$j]['continent']&lt;/td&gt;
  &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;";
  }
  ?&gt;
  </code></pre>
  
  <p>The error get repeated 8 times,since those are the total number of rows i am having.</p>